--- a/src/lte/helper/lena-helper.cc Thu Mar 10 18:15:26 2011 +0100
+++ b/src/lte/helper/lena-helper.cc Thu Mar 10 18:57:41 2011 +0100
@@ -27,15 +27,15 @@
#include <ns3/lte-ue-mac.h>
#include <ns3/lte-enb-mac.h>
-#include <ns3/enb-phy.h>
-#include <ns3/ue-phy.h>
+#include <ns3/lte-enb-phy.h>
+#include <ns3/lte-ue-phy.h>
#include <ns3/lte-spectrum-phy.h>
#include <ns3/lte-sinr-chunk-processor.h>
#include <ns3/single-model-spectrum-channel.h>
#include <ns3/friis-spectrum-propagation-loss.h>
-#include <ns3/enb-net-device.h>
-#include <ns3/ue-net-device.h>
+#include <ns3/lte-enb-net-device.h>
+#include <ns3/lte-ue-net-device.h>
#include <ns3/lte-spectrum-value-helper.h>
@@ -102,7 +102,7 @@
Ptr<NetDevice>
LenaHelper::InstallSingleEnbDevice (Ptr<Node> n)
{
- Ptr<EnbLtePhy> phy = CreateObject<EnbLtePhy> ();
+ Ptr<LteEnbPhy> phy = CreateObject<LteEnbPhy> ();
Ptr<LteSpectrumPhy> dlPhy = CreateObject<LteSpectrumPhy> ();
Ptr<LteSpectrumPhy> ulPhy = CreateObject<LteSpectrumPhy> ();
@@ -123,14 +123,14 @@
m_uplinkChannel->AddRx (ulPhy);
- Ptr<EnbNetDevice> dev = CreateObject<EnbNetDevice> (n, phy);
+ Ptr<LteEnbNetDevice> dev = CreateObject<LteEnbNetDevice> (n, phy);
phy->SetDevice (dev);
dlPhy->SetDevice (dev);
ulPhy->SetDevice (dev);
n->AddDevice (dev);
Ptr<LteEnbMac> mac = dev->GetMac ();
- ulPhy->SetPhyMacRxEndOkCallback (MakeCallback (&EnbLtePhy::PhyPduReceived, phy));
+ ulPhy->SetPhyMacRxEndOkCallback (MakeCallback (&LteEnbPhy::PhyPduReceived, phy));
dev->Start ();
return dev;
@@ -139,7 +139,7 @@
Ptr<NetDevice>
LenaHelper::InstallSingleUeDevice (Ptr<Node> n)
{
- Ptr<UeLtePhy> phy = CreateObject<UeLtePhy> ();
+ Ptr<LteUePhy> phy = CreateObject<LteUePhy> ();
Ptr<LteSpectrumPhy> dlPhy = CreateObject<LteSpectrumPhy> ();
Ptr<LteSpectrumPhy> ulPhy = CreateObject<LteSpectrumPhy> ();
@@ -163,14 +163,14 @@
m_downlinkChannel->AddRx (dlPhy);
- Ptr<UeNetDevice> dev = CreateObject<UeNetDevice> (n, phy);
+ Ptr<LteUeNetDevice> dev = CreateObject<LteUeNetDevice> (n, phy);
phy->SetDevice (dev);
dlPhy->SetDevice (dev);
ulPhy->SetDevice (dev);
n->AddDevice (dev);
Ptr<LteUeMac> mac = dev->GetMac ();
- dlPhy->SetPhyMacRxEndOkCallback (MakeCallback (&UeLtePhy::PhyPduReceived, phy));
+ dlPhy->SetPhyMacRxEndOkCallback (MakeCallback (&LteUePhy::PhyPduReceived, phy));
dev->Start ();
return dev;
@@ -190,19 +190,19 @@
LenaHelper::Attach (Ptr<NetDevice> ueDevice, Ptr<NetDevice> enbDevice)
{
// setup RRC connection
- Ptr<LteEnbRrc> enbRrc = enbDevice->GetObject<EnbNetDevice> ()->GetRrc ();
+ Ptr<LteEnbRrc> enbRrc = enbDevice->GetObject<LteEnbNetDevice> ()->GetRrc ();
uint16_t rnti = enbRrc->AddUe ();
- Ptr<LteUeRrc> ueRrc = ueDevice->GetObject<UeNetDevice> ()->GetRrc ();
+ Ptr<LteUeRrc> ueRrc = ueDevice->GetObject<LteUeNetDevice> ()->GetRrc ();
ueRrc->ConfigureUe (rnti);
// attach UE PHY to eNB
- ueDevice->GetObject<UeNetDevice> ()->SetTargetEnb (enbDevice->GetObject<EnbNetDevice> ());
+ ueDevice->GetObject<LteUeNetDevice> ()->SetTargetEnb (enbDevice->GetObject<LteEnbNetDevice> ());
// WILD HACK - should be done through PHY SAP, probably passing by RRC
- Ptr<UeLtePhy> uePhy = ueDevice->GetObject<UeNetDevice> ()->GetPhy ();
+ Ptr<LteUePhy> uePhy = ueDevice->GetObject<LteUeNetDevice> ()->GetPhy ();
uePhy->SetRnti (rnti);
- Ptr<EnbLtePhy> enbPhy = enbDevice->GetObject<EnbNetDevice> ()->GetPhy ();
+ Ptr<LteEnbPhy> enbPhy = enbDevice->GetObject<LteEnbNetDevice> ()->GetPhy ();
enbPhy->AddUePhy (rnti, uePhy);
}
@@ -220,9 +220,9 @@
void
LenaHelper::ActivateEpsBearer (Ptr<NetDevice> ueDevice, EpsBearer bearer)
{
- Ptr<EnbNetDevice> enbDevice = ueDevice->GetObject<UeNetDevice> ()->GetTargetEnb ();
- Ptr<LteEnbRrc> enbRrc = enbDevice->GetObject<EnbNetDevice> ()->GetRrc ();
- Ptr<LteUeRrc> ueRrc = ueDevice->GetObject<UeNetDevice> ()->GetRrc ();
+ Ptr<LteEnbNetDevice> enbDevice = ueDevice->GetObject<LteUeNetDevice> ()->GetTargetEnb ();
+ Ptr<LteEnbRrc> enbRrc = enbDevice->GetObject<LteEnbNetDevice> ()->GetRrc ();
+ Ptr<LteUeRrc> ueRrc = ueDevice->GetObject<LteUeNetDevice> ()->GetRrc ();
uint16_t rnti = ueRrc->GetRnti ();
uint8_t lcid = enbRrc->SetupRadioBearer (rnti, bearer);
ueRrc->SetupRadioBearer (rnti, bearer, lcid);
@@ -240,8 +240,8 @@
LogComponentEnable ("RrPacketScheduler", LOG_LEVEL_ALL);
LogComponentEnable ("LtePhy", LOG_LEVEL_ALL);
- LogComponentEnable ("EnbLtePhy", LOG_LEVEL_ALL);
- LogComponentEnable ("UeLtePhy", LOG_LEVEL_ALL);
+ LogComponentEnable ("LteEnbPhy", LOG_LEVEL_ALL);
+ LogComponentEnable ("LteUePhy", LOG_LEVEL_ALL);
LogComponentEnable ("LteSpectrumPhy", LOG_LEVEL_ALL);
LogComponentEnable ("LteInterference", LOG_LEVEL_ALL);
@@ -255,8 +255,8 @@
LogComponentEnable ("PathLossModel", LOG_LEVEL_ALL);
LogComponentEnable ("LteNetDevice", LOG_LEVEL_ALL);
- LogComponentEnable ("UeNetDevice", LOG_LEVEL_ALL);
- LogComponentEnable ("EnbNetDevice", LOG_LEVEL_ALL);
+ LogComponentEnable ("LteUeNetDevice", LOG_LEVEL_ALL);
+ LogComponentEnable ("LteEnbNetDevice", LOG_LEVEL_ALL);
}
--- a/src/lte/helper/lena-helper.h Thu Mar 10 18:15:26 2011 +0100
+++ b/src/lte/helper/lena-helper.h Thu Mar 10 18:57:41 2011 +0100
@@ -34,8 +34,8 @@
namespace ns3 {
-class UeLtePhy;
-class EnbLtePhy;
+class LteUePhy;
+class LteEnbPhy;
class SpectrumChannel;
--- a/src/lte/model/amc-module.cc Thu Mar 10 18:15:26 2011 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,326 +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
- *
- * Original Author: Giuseppe Piro <g.piro@poliba.it>
- * Modified by: Marco Miozzo <mmiozzo@cttc.es>
- * Nicola Baldo <nbaldo@cttc.es>
- */
-
-
-#include "amc-module.h"
-#include <ns3/log.h>
-#include <ns3/assert.h>
-#include <math.h>
-#include <ns3/spectrum-value.h>
-
-NS_LOG_COMPONENT_DEFINE ("AmcModule");
-
-namespace ns3 {
-
-
-int CqiIndex[15] = {
- 1, 2, 3, 4, 5, 6, // QAM
- 7, 8, 9, // 4-QAM
- 10, 11, 12, 13, 14, 15 // 16QAM
-};
-
-
-double SpectralEfficiencyForCqiIndex[15] = {
- 0.15, 0.23, 0.38, 0.6, 0.88, 1.18,
- 1.48, 1.91, 2.41,
- 2.73, 3.32, 3.9, 4.52, 5.12, 5.55
-};
-
-int McsIndex[32] = {
- 0, // RESERVED
- 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, // QAM
- 12, 13, 14, 15, 16, 17, 18, // 4-QAM
- 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, // 16-QAM
- 30, // QAM, RESERVED
- 31 // RESERVED
-};
-
-// legacy table
-// int ModulationSchemeForMcsIndex[32] = {
-// 0, // Not defined
-// 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
-// 4, 4, 4, 4, 4, 4, 4,
-// 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
-// 2,
-// 0 // Not defined
-// };
-
-// Table 7.1.7.1-1 of 36.213 v8.6.0
-int ModulationSchemeForMcsIndex[32] = {
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 4, 4, 4, 4, 4, 4, 4,
- 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
- 2, // reserved
- 4, // reserved
- 6, // reserved
-};
-
-// legacy table
-// double SpectralEfficiencyForMcsIndex[32] = {
-// 0,
-// 0.15, 0.19, 0.23, 0.31, 0.38, 0.49, 0.6, 0.74, 0.88, 1.03, 1.18,
-// 1.33, 1.48, 1.7, 1.91, 2.16, 2.41, 2.57,
-// 2.73, 3.03, 3.32, 3.61, 3.9, 4.21, 4.52, 4.82, 5.12, 5.33, 5.55,
-// 2.4,
-// 0
-// };
-
-
-double SpectralEfficiencyForMcsIndex[32] = {
- 0.15, 0.19, 0.23, 0.31, 0.38, 0.49, 0.6, 0.74, 0.88, 1.03, 1.18,
- 1.33, 1.48, 1.7, 1.91, 2.16, 2.41, 2.57,
- 2.73, 3.03, 3.32, 3.61, 3.9, 4.21, 4.52, 4.82, 5.12, 5.33, 5.55,
- 0, 0, 0
-};
-
-
-int TransportBlockSize[32] = {
- 0,
- 18, 23, 28, 37, 45, 59, 72, 89, 105, 123, 141,
- 159, 177, 203, 230, 259, 289, 288,
- 308, 328, 363, 399, 433, 468, 506, 543, 578, 614, 640,
- 667,
- 0
-};
-
-int McsToItbs[29] = {
- 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
-};
-
-
-int TransportBlockSizeTable [110][27] = {
-
- /* NPRB 001*/ { 16, 24, 32, 40, 56, 72, 328, 104, 120, 136, 144, 176, 208, 224, 256, 280, 328, 336, 376, 408, 440, 488, 520, 552, 584, 616, 712},
- /* NPRB 002*/ { 32, 56, 72, 104, 120, 144, 176, 224, 256, 296, 328, 376, 440, 488, 552, 600, 632, 696, 776, 840, 904, 1000, 1064, 1128, 1192, 1256, 1480},
- /* NPRB 003*/ { 56, 88, 144, 176, 208, 224, 256, 328, 392, 456, 504, 584, 680, 744, 840, 904, 968, 1064, 1160, 1288, 1384, 1480, 1608, 1736, 1800, 1864, 2216},
- /* NPRB 004*/ { 88, 144, 176, 208, 256, 328, 392, 472, 536, 616, 680, 776, 904, 1000, 1128, 1224, 1288, 1416, 1544, 1736, 1864, 1992, 2152, 2280, 2408, 2536, 2984},
- /* NPRB 005*/ { 120, 176, 208, 256, 328, 424, 504, 584, 680, 776, 872, 1000, 1128, 1256, 1416, 1544, 1608, 1800, 1992, 2152, 2344, 2472, 2664, 2856, 2984, 3112, 3752},
- /* NPRB 006*/ { 152, 208, 256, 328, 408, 504, 600, 712, 808, 936, 1032, 1192, 1352, 1544, 1736, 1800, 1928, 2152, 2344, 2600, 2792, 2984, 3240, 3496, 3624, 3752, 4392},
- /* NPRB 007*/ { 176, 224, 296, 392, 488, 600, 712, 840, 968, 1096, 1224, 1384, 1608, 1800, 1992, 2152, 2280, 2536, 2792, 2984, 3240, 3496, 3752, 4008, 4264, 4392, 5160},
- /* NPRB 008*/ { 208, 256, 328, 440, 552, 680, 808, 968, 1096, 1256, 1384, 1608, 1800, 2024, 2280, 2472, 2600, 2856, 3112, 3496, 3752, 4008, 4264, 4584, 4968, 5160, 5992},
- /* NPRB 009*/ { 224, 328, 376, 504, 632, 776, 936, 1096, 1256, 1416, 1544, 1800, 2024, 2280, 2600, 2728, 2984, 3240, 3624, 3880, 4136, 4584, 4776, 5160, 5544, 5736, 6712},
- /* NPRB 010*/ { 256, 344, 424, 568, 696, 872, 1032, 1224, 1384, 1544, 1736, 2024, 2280, 2536, 2856, 3112, 3240, 3624, 4008, 4264, 4584, 4968, 5352, 5736, 5992, 6200, 7480},
- /* NPRB 011*/ { 288, 376, 472, 616, 776, 968, 1128, 1320, 1544, 1736, 1928, 2216, 2472, 2856, 3112, 3368, 3624, 4008, 4392, 4776, 5160, 5544, 5992, 6200, 6712, 6968, 8248},
- /* NPRB 012*/ { 328, 424, 520, 680, 840, 1032, 1224, 1480, 1672, 1864, 2088, 2408, 2728, 3112, 3496, 3624, 3880, 4392, 4776, 5160, 5544, 5992, 6456, 6968, 7224, 7480, 8760},
- /* NPRB 013*/ { 344, 456, 568, 744, 904, 1128, 1352, 1608, 1800, 2024, 2280, 2600, 2984, 3368, 3752, 4008, 4264, 4776, 5160, 5544, 5992, 6456, 6968, 7480, 7992, 8248, 9528},
- /* NPRB 014*/ { 376, 488, 616, 808, 1000, 1224, 1480, 1672, 1928, 2216, 2472, 2792, 3240, 3624, 4008, 4264, 4584, 5160, 5544, 5992, 6456, 6968, 7480, 7992, 8504, 8760, 10296},
- /* NPRB 015*/ { 392, 520, 648, 872, 1064, 1320, 1544, 1800, 2088, 2344, 2664, 2984, 3368, 3880, 4264, 4584, 4968, 5352, 5992, 6456, 6968, 7480, 7992, 8504, 9144, 9528, 11064},
- /* NPRB 016*/ { 424, 568, 696, 904, 1128, 1384, 1672, 1928, 2216, 2536, 2792, 3240, 3624, 4136, 4584, 4968, 5160, 5736, 6200, 6968, 7480, 7992, 8504, 9144, 9912, 10296, 11832},
- /* NPRB 017*/ { 456, 600, 744, 968, 1192, 1480, 1736, 2088, 2344, 2664, 2984, 3496, 3880, 4392, 4968, 5160, 5544, 6200, 6712, 7224, 7992, 8504, 9144, 9912, 10296, 10680, 12576},
- /* NPRB 018*/ { 488, 632, 776, 1032, 1288, 1544, 1864, 2216, 2536, 2856, 3112, 3624, 4136, 4584, 5160, 5544, 5992, 6456, 7224, 7736, 8248, 9144, 9528, 10296, 11064, 11448, 13536},
- /* NPRB 019*/ { 504, 680, 840, 1096, 1352, 1672, 1992, 2344, 2664, 2984, 3368, 3880, 4392, 4968, 5544, 5736, 6200, 6712, 7480, 8248, 8760, 9528, 10296, 11064, 11448, 12216, 14112},
- /* NPRB 020*/ { 536, 712, 872, 1160, 1416, 1736, 2088, 2472, 2792, 3112, 3496, 4008, 4584, 5160, 5736, 6200, 6456, 7224, 7992, 8504, 9144, 9912, 10680, 11448, 12216, 12576, 14688},
- /* NPRB 021*/ { 568, 744, 936, 1224, 1480, 1864, 2216, 2536, 2984, 3368, 3752, 4264, 4776, 5352, 5992, 6456, 6712, 7480, 8248, 9144, 9912, 10680, 11448, 12216, 12960, 13536, 15264},
- /* NPRB 022*/ { 600, 776, 968, 1256, 1544, 1928, 2280, 2664, 3112, 3496, 3880, 4392, 4968, 5736, 6200, 6712, 7224, 7992, 8760, 9528, 10296, 11064, 11832, 12576, 13536, 14112, 16416},
- /* NPRB 023*/ { 616, 808, 1000, 1320, 1608, 2024, 2408, 2792, 3240, 3624, 4008, 4584, 5352, 5992, 6456, 6968, 7480, 8248, 9144, 9912, 10680, 11448, 12576, 12960, 14112, 14688, 16992},
- /* NPRB 024*/ { 648, 872, 1064, 1384, 1736, 2088, 2472, 2984, 3368, 3752, 4264, 4776, 5544, 6200, 6968, 7224, 7736, 8760, 9528, 10296, 11064, 12216, 12960, 13536, 14688, 15264, 17568},
- /* NPRB 025*/ { 680, 904, 1096, 1416, 1800, 2216, 2600, 3112, 3496, 4008, 4392, 4968, 5736, 6456, 7224, 7736, 7992, 9144, 9912, 10680, 11448, 12576, 13536, 14112, 15264, 15840, 18336},
- /* NPRB 026*/ { 712, 936, 1160, 1480, 1864, 2280, 2728, 3240, 3624, 4136, 4584, 5352, 5992, 6712, 7480, 7992, 8504, 9528, 10296, 11064, 12216, 12960, 14112, 14688, 15840, 16416, 19080},
- /* NPRB 027*/ { 744, 968, 1192, 1544, 1928, 2344, 2792, 3368, 3752, 4264, 4776, 5544, 6200, 6968, 7736, 8248, 8760, 9912, 10680, 11448, 12576, 13536, 14688, 15264, 16416, 16992, 19848},
- /* NPRB 028*/ { 776, 1000, 1256, 1608, 1992, 2472, 2984, 3368, 3880, 4392, 4968, 5736, 6456, 7224, 7992, 8504, 9144, 10296, 11064, 12216, 12960, 14112, 15264, 15840, 16992, 17568, 20616},
- /* NPRB 029*/ { 776, 1032, 1288, 1672, 2088, 2536, 2984, 3496, 4008, 4584, 5160, 5992, 6712, 7480, 8248, 8760, 9528, 10296, 11448, 12576, 13536, 14688, 15840, 16416, 17568, 18336, 21384},
- /* NPRB 030*/ { 808, 1064, 1320, 1736, 2152, 2664, 3112, 3624, 4264, 4776, 5352, 5992, 6712, 7736, 8504, 9144, 9912, 10680, 11832, 12960, 14112, 15264, 16416, 16992, 18336, 19080, 22152},
- /* NPRB 031*/ { 840, 1128, 1384, 1800, 2216, 2728, 3240, 3752, 4392, 4968, 5544, 6200, 6968, 7992, 8760, 9528, 9912, 11064, 12216, 13536, 14688, 15840, 16992, 17568, 19080, 19848, 22920},
- /* NPRB 032*/ { 872, 1160, 1416, 1864, 2280, 2792, 3368, 3880, 4584, 5160, 5736, 6456, 7224, 8248, 9144, 9912, 10296, 11448, 12576, 13536, 14688, 15840, 16992, 18336, 19848, 20616, 23688},
- /* NPRB 033*/ { 904, 1192, 1480, 1928, 2344, 2856, 3496, 4008, 4584, 5160, 5736, 6712, 7480, 8504, 9528, 10296, 10680, 11832, 12960, 14112, 15264, 16416, 17568, 19080, 19848, 20616, 24496},
- /* NPRB 034*/ { 936, 1224, 1544, 1992, 2408, 2984, 3496, 4136, 4776, 5352, 5992, 6968, 7736, 8760, 9912, 10296, 11064, 12216, 13536, 14688, 15840, 16992, 18336, 19848, 20616, 21384, 25456},
- /* NPRB 035*/ { 968, 1256, 1544, 2024, 2472, 3112, 3624, 4264, 4968, 5544, 6200, 6968, 7992, 9144, 9912, 10680, 11448, 12576, 14112, 15264, 16416, 17568, 19080, 19848, 21384, 22152, 25456},
- /* NPRB 036*/ { 1000, 1288, 1608, 2088, 2600, 3112, 3752, 4392, 4968, 5736, 6200, 7224, 8248, 9144, 10296, 11064, 11832, 12960, 14112, 15264, 16992, 18336, 19080, 20616, 22152, 22920, 26416},
- /* NPRB 037*/ { 1032, 1352, 1672, 2152, 2664, 3240, 3880, 4584, 5160, 5736, 6456, 7480, 8504, 9528, 10680, 11448, 12216, 13536, 14688, 15840, 16992, 18336, 19848, 21384, 22920, 23688, 27376},
- /* NPRB 038*/ { 1032, 1384, 1672, 2216, 2728, 3368, 4008, 4584, 5352, 5992, 6712, 7736, 8760, 9912, 11064, 11832, 12216, 13536, 15264, 16416, 17568, 19080, 20616, 22152, 22920, 24496, 28336},
- /* NPRB 039*/ { 1064, 1416, 1736, 2280, 2792, 3496, 4136, 4776, 5544, 6200, 6712, 7736, 8760, 9912, 11064, 11832, 12576, 14112, 15264, 16992, 18336, 19848, 21384, 22152, 23688, 24496, 29296},
- /* NPRB 040*/ { 1096, 1416, 1800, 2344, 2856, 3496, 4136, 4968, 5544, 6200, 6968, 7992, 9144, 10296, 11448, 12216, 12960, 14688, 15840, 16992, 18336, 19848, 21384, 22920, 24496, 25456, 29296},
- /* NPRB 041*/ { 1128, 1480, 1800, 2408, 2984, 3624, 4264, 4968, 5736, 6456, 7224, 8248, 9528, 10680, 11832, 12576, 13536, 14688, 16416, 17568, 19080, 20616, 22152, 23688, 25456, 26416, 30576},
- /* NPRB 042*/ { 1160, 1544, 1864, 2472, 2984, 3752, 4392, 5160, 5992, 6712, 7480, 8504, 9528, 10680, 12216, 12960, 13536, 15264, 16416, 18336, 19848, 21384, 22920, 24496, 25456, 26416, 30576},
- /* NPRB 043*/ { 1192, 1544, 1928, 2536, 3112, 3752, 4584, 5352, 5992, 6712, 7480, 8760, 9912, 11064, 12216, 12960, 14112, 15264, 16992, 18336, 19848, 21384, 22920, 24496, 26416, 27376, 31704},
- /* NPRB 044*/ { 1224, 1608, 1992, 2536, 3112, 3880, 4584, 5352, 6200, 6968, 7736, 8760, 9912, 11448, 12576, 13536, 14112, 15840, 17568, 19080, 20616, 22152, 23688, 25456, 26416, 28336, 32856},
- /* NPRB 045*/ { 1256, 1608, 2024, 2600, 3240, 4008, 4776, 5544, 6200, 6968, 7992, 9144, 10296, 11448, 12960, 13536, 14688, 16416, 17568, 19080, 20616, 22920, 24496, 25456, 27376, 28336, 32856},
- /* NPRB 046*/ { 1256, 1672, 2088, 2664, 3240, 4008, 4776, 5736, 6456, 7224, 7992, 9144, 10680, 11832, 12960, 14112, 14688, 16416, 18336, 19848, 21384, 22920, 24496, 26416, 28336, 29296, 34008},
- /* NPRB 047*/ { 1288, 1736, 2088, 2728, 3368, 4136, 4968, 5736, 6456, 7480, 8248, 9528, 10680, 12216, 13536, 14688, 15264, 16992, 18336, 20616, 22152, 23688, 25456, 27376, 28336, 29296, 35160},
- /* NPRB 048*/ { 1320, 1736, 2152, 2792, 3496, 4264, 4968, 5992, 6712, 7480, 8504, 9528, 11064, 12216, 13536, 14688, 15840, 17568, 19080, 20616, 22152, 24496, 25456, 27376, 29296, 30576, 35160},
- /* NPRB 049*/ { 1352, 1800, 2216, 2856, 3496, 4392, 5160, 5992, 6968, 7736, 8504, 9912, 11064, 12576, 14112, 15264, 15840, 17568, 19080, 21384, 22920, 24496, 26416, 28336, 29296, 31704, 36696},
- /* NPRB 050*/ { 1384, 1800, 2216, 2856, 3624, 4392, 5160, 6200, 6968, 7992, 8760, 9912, 11448, 12960, 14112, 15264, 16416, 18336, 19848, 21384, 22920, 25456, 27376, 28336, 30576, 31704, 36696},
- /* NPRB 051*/ { 1416, 1864, 2280, 2984, 3624, 4584, 5352, 6200, 7224, 7992, 9144, 10296, 11832, 12960, 14688, 15840, 16416, 18336, 19848, 22152, 23688, 25456, 27376, 29296, 31704, 32856, 37888},
- /* NPRB 052*/ { 1416, 1864, 2344, 2984, 3752, 4584, 5352, 6456, 7224, 8248, 9144, 10680, 11832, 13536, 14688, 15840, 16992, 19080, 20616, 22152, 24496, 26416, 28336, 29296, 31704, 32856, 37888},
- /* NPRB 053*/ { 1480, 1928, 2344, 3112, 3752, 4776, 5544, 6456, 7480, 8248, 9144, 10680, 12216, 13536, 15264, 16416, 16992, 19080, 21384, 22920, 24496, 26416, 28336, 30576, 32856, 34008, 39232},
- /* NPRB 054*/ { 1480, 1992, 2408, 3112, 3880, 4776, 5736, 6712, 7480, 8504, 9528, 11064, 12216, 14112, 15264, 16416, 17568, 19848, 21384, 22920, 25456, 27376, 29296, 30576, 32856, 34008, 40576},
- /* NPRB 055*/ { 1544, 1992, 2472, 3240, 4008, 4776, 5736, 6712, 7736, 8760, 9528, 11064, 12576, 14112, 15840, 16992, 17568, 19848, 22152, 23688, 25456, 27376, 29296, 31704, 34008, 35160, 40576},
- /* NPRB 056*/ { 1544, 2024, 2536, 3240, 4008, 4968, 5992, 6712, 7736, 8760, 9912, 11448, 12576, 14688, 15840, 16992, 18336, 20616, 22152, 24496, 26416, 28336, 30576, 31704, 34008, 35160, 40576},
- /* NPRB 057*/ { 1608, 2088, 2536, 3368, 4136, 4968, 5992, 6968, 7992, 9144, 9912, 11448, 12960, 14688, 16416, 17568, 18336, 20616, 22920, 24496, 26416, 28336, 30576, 32856, 35160, 36696, 42368},
- /* NPRB 058*/ { 1608, 2088, 2600, 3368, 4136, 5160, 5992, 6968, 7992, 9144, 10296, 11832, 12960, 14688, 16416, 17568, 19080, 20616, 22920, 25456, 27376, 29296, 31704, 32856, 35160, 36696, 42368},
- /* NPRB 059*/ { 1608, 2152, 2664, 3496, 4264, 5160, 6200, 7224, 8248, 9144, 10296, 11832, 13536, 15264, 16992, 18336, 19080, 21384, 23688, 25456, 27376, 29296, 31704, 34008, 36696, 37888, 43816},
- /* NPRB 060*/ { 1672, 2152, 2664, 3496, 4264, 5352, 6200, 7224, 8504, 9528, 10680, 12216, 13536, 15264, 16992, 18336, 19848, 21384, 23688, 25456, 28336, 30576, 32856, 34008, 36696, 37888, 43816},
- /* NPRB 061*/ { 1672, 2216, 2728, 3624, 4392, 5352, 6456, 7480, 8504, 9528, 10680, 12216, 14112, 15840, 17568, 18336, 19848, 22152, 24496, 26416, 28336, 30576, 32856, 35160, 36696, 39232, 45352},
- /* NPRB 062*/ { 1736, 2280, 2792, 3624, 4392, 5544, 6456, 7480, 8760, 9912, 11064, 12576, 14112, 15840, 17568, 19080, 19848, 22152, 24496, 26416, 29296, 31704, 34008, 35160, 37888, 39232, 45352},
- /* NPRB 063*/ { 1736, 2280, 2856, 3624, 4584, 5544, 6456, 7736, 8760, 9912, 11064, 12576, 14112, 16416, 18336, 19080, 20616, 22920, 24496, 27376, 29296, 31704, 34008, 36696, 37888, 40576, 46888},
- /* NPRB 064*/ { 1800, 2344, 2856, 3752, 4584, 5736, 6712, 7736, 9144, 10296, 11448, 12960, 14688, 16416, 18336, 19848, 20616, 22920, 25456, 27376, 29296, 31704, 34008, 36696, 39232, 40576, 46888},
- /* NPRB 065*/ { 1800, 2344, 2856, 3752, 4584, 5736, 6712, 7992, 9144, 10296, 11448, 12960, 14688, 16992, 18336, 19848, 21384, 23688, 25456, 28336, 30576, 32856, 35160, 37888, 39232, 40576, 48936},
- /* NPRB 066*/ { 1800, 2408, 2984, 3880, 4776, 5736, 6968, 7992, 9144, 10296, 11448, 13536, 15264, 16992, 19080, 20616, 21384, 23688, 26416, 28336, 30576, 32856, 35160, 37888, 40576, 42368, 48936},
- /* NPRB 067*/ { 1864, 2472, 2984, 3880, 4776, 5992, 6968, 8248, 9528, 10680, 11832, 13536, 15264, 16992, 19080, 20616, 22152, 24496, 26416, 29296, 31704, 34008, 36696, 37888, 40576, 42368, 48936},
- /* NPRB 068*/ { 1864, 2472, 3112, 4008, 4968, 5992, 6968, 8248, 9528, 10680, 11832, 13536, 15264, 17568, 19848, 20616, 22152, 24496, 27376, 29296, 31704, 34008, 36696, 39232, 42368, 43816, 51024},
- /* NPRB 069*/ { 1928, 2536, 3112, 4008, 4968, 5992, 7224, 8504, 9528, 11064, 12216, 14112, 15840, 17568, 19848, 21384, 22152, 24496, 27376, 29296, 31704, 35160, 36696, 39232, 42368, 43816, 51024},
- /* NPRB 070*/ { 1928, 2536, 3112, 4136, 4968, 6200, 7224, 8504, 9912, 11064, 12216, 14112, 15840, 18336, 19848, 21384, 22920, 25456, 27376, 30576, 32856, 35160, 37888, 40576, 42368, 43816, 52752},
- /* NPRB 071*/ { 1992, 2600, 3240, 4136, 5160, 6200, 7480, 8760, 9912, 11064, 12576, 14112, 16416, 18336, 20616, 22152, 22920, 25456, 28336, 30576, 32856, 35160, 37888, 40576, 43816, 45352, 52752},
- /* NPRB 072*/ { 1992, 2600, 3240, 4264, 5160, 6200, 7480, 8760, 9912, 11448, 12576, 14688, 16416, 18336, 20616, 22152, 23688, 26416, 28336, 30576, 34008, 36696, 39232, 40576, 43816, 45352, 52752},
- /* NPRB 073*/ { 2024, 2664, 3240, 4264, 5160, 6456, 7736, 8760, 10296, 11448, 12960, 14688, 16416, 19080, 20616, 22152, 23688, 26416, 29296, 31704, 34008, 36696, 39232, 42368, 45352, 46888, 55056},
- /* NPRB 074*/ { 2088, 2728, 3368, 4392, 5352, 6456, 7736, 9144, 10296, 11832, 12960, 14688, 16992, 19080, 21384, 22920, 24496, 26416, 29296, 31704, 34008, 36696, 40576, 42368, 45352, 46888, 55056},
- /* NPRB 075*/ { 2088, 2728, 3368, 4392, 5352, 6712, 7736, 9144, 10680, 11832, 12960, 15264, 16992, 19080, 21384, 22920, 24496, 27376, 29296, 32856, 35160, 37888, 40576, 43816, 45352, 46888, 55056},
- /* NPRB 076*/ { 2088, 2792, 3368, 4392, 5544, 6712, 7992, 9144, 10680, 11832, 13536, 15264, 17568, 19848, 22152, 23688, 24496, 27376, 30576, 32856, 35160, 37888, 40576, 43816, 46888, 48936, 55056},
- /* NPRB 077*/ { 2152, 2792, 3496, 4584, 5544, 6712, 7992, 9528, 10680, 12216, 13536, 15840, 17568, 19848, 22152, 23688, 25456, 27376, 30576, 32856, 35160, 39232, 42368, 43816, 46888, 48936, 57336},
- /* NPRB 078*/ { 2152, 2856, 3496, 4584, 5544, 6968, 8248, 9528, 11064, 12216, 13536, 15840, 17568, 19848, 22152, 23688, 25456, 28336, 30576, 34008, 36696, 39232, 42368, 45352, 46888, 48936, 57336},
- /* NPRB 079*/ { 2216, 2856, 3496, 4584, 5736, 6968, 8248, 9528, 11064, 12576, 14112, 15840, 18336, 20616, 22920, 24496, 25456, 28336, 31704, 34008, 36696, 39232, 42368, 45352, 48936, 51024, 57336},
- /* NPRB 080*/ { 2216, 2856, 3624, 4776, 5736, 6968, 8248, 9912, 11064, 12576, 14112, 16416, 18336, 20616, 22920, 24496, 26416, 29296, 31704, 34008, 36696, 40576, 43816, 45352, 48936, 51024, 59256},
- /* NPRB 081*/ { 2280, 2984, 3624, 4776, 5736, 7224, 8504, 9912, 11448, 12960, 14112, 16416, 18336, 20616, 22920, 24496, 26416, 29296, 31704, 35160, 37888, 40576, 43816, 46888, 48936, 51024, 59256},
- /* NPRB 082*/ { 2280, 2984, 3624, 4776, 5992, 7224, 8504, 9912, 11448, 12960, 14688, 16416, 19080, 21384, 23688, 25456, 26416, 29296, 32856, 35160, 37888, 40576, 43816, 46888, 51024, 52752, 59256},
- /* NPRB 083*/ { 2280, 2984, 3752, 4776, 5992, 7224, 8760, 10296, 11448, 12960, 14688, 16992, 19080, 21384, 23688, 25456, 27376, 30576, 32856, 35160, 39232, 42368, 45352, 46888, 51024, 52752, 61664},
- /* NPRB 084*/ { 2344, 3112, 3752, 4968, 5992, 7480, 8760, 10296, 11832, 13536, 14688, 16992, 19080, 21384, 24496, 25456, 27376, 30576, 32856, 36696, 39232, 42368, 45352, 48936, 51024, 52752, 61664},
- /* NPRB 085*/ { 2344, 3112, 3880, 4968, 5992, 7480, 8760, 10296, 11832, 13536, 14688, 16992, 19080, 22152, 24496, 26416, 27376, 30576, 34008, 36696, 39232, 42368, 45352, 48936, 52752, 55056, 61664},
- /* NPRB 086*/ { 2408, 3112, 3880, 4968, 6200, 7480, 9144, 10680, 12216, 13536, 15264, 17568, 19848, 22152, 24496, 26416, 28336, 30576, 34008, 36696, 40576, 43816, 46888, 48936, 52752, 55056, 63776},
- /* NPRB 087*/ { 2408, 3240, 3880, 5160, 6200, 7736, 9144, 10680, 12216, 13536, 15264, 17568, 19848, 22152, 25456, 26416, 28336, 31704, 34008, 37888, 40576, 43816, 46888, 51024, 52752, 55056, 63776},
- /* NPRB 088*/ { 2472, 3240, 4008, 5160, 6200, 7736, 9144, 10680, 12216, 14112, 15264, 17568, 19848, 22920, 25456, 27376, 28336, 31704, 35160, 37888, 40576, 43816, 46888, 51024, 52752, 55056, 63776},
- /* NPRB 089*/ { 2472, 3240, 4008, 5160, 6456, 7736, 9144, 11064, 12576, 14112, 15840, 18336, 20616, 22920, 25456, 27376, 29296, 31704, 35160, 37888, 42368, 45352, 48936, 51024, 55056, 57336, 66592},
- /* NPRB 090*/ { 2536, 3240, 4008, 5352, 6456, 7992, 9528, 11064, 12576, 14112, 15840, 18336, 20616, 22920, 25456, 27376, 29296, 32856, 35160, 39232, 42368, 45352, 48936, 51024, 55056, 57336, 66592},
- /* NPRB 091*/ { 2536, 3368, 4136, 5352, 6456, 7992, 9528, 11064, 12576, 14112, 15840, 18336, 20616, 23688, 26416, 28336, 29296, 32856, 36696, 39232, 42368, 45352, 48936, 52752, 55056, 57336, 66592},
- /* NPRB 092*/ { 2536, 3368, 4136, 5352, 6456, 7992, 9528, 11448, 12960, 14688, 16416, 18336, 21384, 23688, 26416, 28336, 30576, 32856, 36696, 39232, 42368, 46888, 48936, 52752, 57336, 59256, 68808},
- /* NPRB 093*/ { 2600, 3368, 4136, 5352, 6712, 8248, 9528, 11448, 12960, 14688, 16416, 19080, 21384, 23688, 26416, 28336, 30576, 34008, 36696, 40576, 43816, 46888, 51024, 52752, 57336, 59256, 68808},
- /* NPRB 094*/ { 2600, 3496, 4264, 5544, 6712, 8248, 9912, 11448, 12960, 14688, 16416, 19080, 21384, 24496, 27376, 29296, 30576, 34008, 37888, 40576, 43816, 46888, 51024, 55056, 57336, 59256, 68808},
- /* NPRB 095*/ { 2664, 3496, 4264, 5544, 6712, 8248, 9912, 11448, 13536, 15264, 16992, 19080, 21384, 24496, 27376, 29296, 30576, 34008, 37888, 40576, 43816, 46888, 51024, 55056, 57336, 61664, 71112},
- /* NPRB 096*/ { 2664, 3496, 4264, 5544, 6968, 8504, 9912, 11832, 13536, 15264, 16992, 19080, 22152, 24496, 27376, 29296, 31704, 35160, 37888, 40576, 45352, 48936, 51024, 55056, 59256, 61664, 71112},
- /* NPRB 097*/ { 2728, 3496, 4392, 5736, 6968, 8504, 10296, 11832, 13536, 15264, 16992, 19848, 22152, 25456, 28336, 29296, 31704, 35160, 37888, 42368, 45352, 48936, 52752, 55056, 59256, 61664, 71112},
- /* NPRB 098*/ { 2728, 3624, 4392, 5736, 6968, 8760, 10296, 11832, 13536, 15264, 16992, 19848, 22152, 25456, 28336, 30576, 31704, 35160, 39232, 42368, 45352, 48936, 52752, 57336, 59256, 61664, 73712},
- /* NPRB 099*/ { 2728, 3624, 4392, 5736, 6968, 8760, 10296, 12216, 14112, 15840, 17568, 19848, 22920, 25456, 28336, 30576, 31704, 35160, 39232, 42368, 46888, 48936, 52752, 57336, 61664, 63776, 73712},
- /* NPRB 100*/ { 2792, 3624, 4584, 5736, 7224, 8760, 10296, 12216, 14112, 15840, 17568, 19848, 22920, 25456, 28336, 30576, 32856, 36696, 39232, 43816, 46888, 51024, 55056, 57336, 61664, 63776, 75376},
- /* NPRB 101*/ { 2792, 3752, 4584, 5992, 7224, 8760, 10680, 12216, 14112, 15840, 17568, 20616, 22920, 26416, 29296, 30576, 32856, 36696, 40576, 43816, 46888, 51024, 55056, 57336, 61664, 63776, 75376},
- /* NPRB 102*/ { 2856, 3752, 4584, 5992, 7224, 9144, 10680, 12576, 14112, 16416, 18336, 20616, 23688, 26416, 29296, 31704, 32856, 36696, 40576, 43816, 46888, 51024, 55056, 59256, 61664, 63776, 75376},
- /* NPRB 103*/ { 2856, 3752, 4584, 5992, 7480, 9144, 10680, 12576, 14688, 16416, 18336, 20616, 23688, 26416, 29296, 31704, 34008, 36696, 40576, 43816, 48936, 51024, 55056, 59256, 63776, 66592, 75376},
- /* NPRB 104*/ { 2856, 3752, 4584, 5992, 7480, 9144, 10680, 12576, 14688, 16416, 18336, 21384, 23688, 26416, 29296, 31704, 34008, 37888, 40576, 45352, 48936, 52752, 57336, 59256, 63776, 66592, 75376},
- /* NPRB 105*/ { 2984, 3880, 4776, 6200, 7480, 9144, 11064, 12960, 14688, 16416, 18336, 21384, 23688, 27376, 30576, 31704, 34008, 37888, 42368, 45352, 48936, 52752, 57336, 59256, 63776, 66592, 75376},
- /* NPRB 106*/ { 2984, 3880, 4776, 6200, 7480, 9528, 11064, 12960, 14688, 16992, 18336, 21384, 24496, 27376, 30576, 32856, 34008, 37888, 42368, 45352, 48936, 52752, 57336, 61664, 63776, 66592, 75376},
- /* NPRB 107*/ { 2984, 3880, 4776, 6200, 7736, 9528, 11064, 12960, 15264, 16992, 19080, 21384, 24496, 27376, 30576, 32856, 35160, 39232, 42368, 46888, 48936, 52752, 57336, 61664, 66592, 68808, 75376},
- /* NPRB 108*/ { 2984, 4008, 4776, 6200, 7736, 9528, 11448, 12960, 15264, 16992, 19080, 22152, 24496, 27376, 30576, 32856, 35160, 39232, 42368, 46888, 51024, 55056, 59256, 61664, 66592, 68808, 75376},
- /* NPRB 109*/ { 2984, 4008, 4968, 6456, 7736, 9528, 11448, 13536, 15264, 16992, 19080, 22152, 24496, 28336, 31704, 34008, 35160, 39232, 43816, 46888, 51024, 55056, 59256, 61664, 66592, 68808, 75376},
- /* NPRB 110*/ { 3112, 4008, 4968, 6456, 7992, 9528, 11448, 13536, 15264, 17568, 19080, 22152, 25456, 28336, 31704, 34008, 35160, 39232, 43816, 46888, 51024, 55056, 59256, 63776, 66592, 71112, 75376}
-
-};
-
-
-
-int
-AmcModule::GetCqiFromSpectralEfficiency (double s)
-{
- NS_LOG_FUNCTION (s);
- int cqi = 1; // == CqiIndex[0]
- while (SpectralEfficiencyForCqiIndex[cqi] < s && cqi <= 14)
- {
- cqi++;
- }
- NS_LOG_FUNCTION (s << cqi);
- return cqi;
-}
-
-
-int
-AmcModule::GetMcsFromCqi (int cqi)
-{
- NS_LOG_FUNCTION (cqi);
- double spectralEfficiency = SpectralEfficiencyForCqiIndex[cqi - 1];
- int mcs = 1;
- while (SpectralEfficiencyForMcsIndex[mcs] < spectralEfficiency && mcs < 28)
- {
- mcs++;
- }
- NS_LOG_FUNCTION (cqi << mcs);
- return mcs;
-}
-
-
-int
-AmcModule::GetTbSizeFromMcs (int mcs)
-{
- NS_LOG_FUNCTION (mcs);
- NS_LOG_FUNCTION (mcs << TransportBlockSize[mcs]);
- return TransportBlockSize[mcs];
-}
-
-int
-AmcModule::GetTbSizeFromMcs (int mcs, int nprb)
-{
- NS_LOG_FUNCTION (mcs);
- NS_LOG_FUNCTION (mcs << TransportBlockSize[mcs]);
-
- NS_ASSERT_MSG (mcs < 29, "MCS=" << mcs);
- NS_ASSERT_MSG (nprb < 111, "NPRB=" << nprb);
-
- int itbs = McsToItbs[mcs];
- return (TransportBlockSizeTable[nprb - 1][itbs]);
-}
-
-
-double
-AmcModule::GetSpectralEfficiencyFromCqi (int cqi)
-{
- NS_LOG_FUNCTION (cqi);
- NS_LOG_FUNCTION (cqi << SpectralEfficiencyForCqiIndex[cqi - 1]);
- return SpectralEfficiencyForCqiIndex[cqi - 1];
-}
-
-
-std::vector<int>
-AmcModule::CreateCqiFeedbacks (const SpectrumValue& sinr)
-{
- NS_LOG_FUNCTION_NOARGS ();
-
- std::vector<int> cqi;
- Values::const_iterator it;
-
- for (it = sinr.ConstValuesBegin (); it != sinr.ConstValuesEnd (); it++)
- {
- double sinr_ = (*it);
-
- /*
- * Compute the spectral efficiency from the SINR
- * SINR
- * spectralEfficiency = log2 (1 + -------------------- )
- * -ln(5*BER)/1.5
- * NB: SINR must be expressed in natural unit:
- * (SINR)dB => 10 ^ (SINR/10)
- */
-
- double s = log2 ( 1 + (
- pow (10, sinr_ / 10 ) /
- ( (-log (5.0 * 0.00005 )) / 1.5) ));
-
- int cqi_ = GetCqiFromSpectralEfficiency (s);
-
- NS_LOG_FUNCTION ("channel_id = " << cqi.size ()
- << "sinr = " << sinr_
- << "spectral efficiency =" << s
- << " ---- CQI = " << cqi_ );
-
- cqi.push_back (cqi_);
- }
-
- return cqi;
-}
-
-} // namespace ns3
--- a/src/lte/model/amc-module.h Thu Mar 10 18:15:26 2011 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,101 +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
- *
- * Original Author: Giuseppe Piro <g.piro@poliba.it>
- * Modified by: Nicola Baldo <nbaldo@cttc.es>
- */
-
-#ifndef AMCMODULE_H
-#define AMCMODULE_H
-
-#include <vector>
-#include <ns3/ptr.h>
-
-namespace ns3 {
-
-class SpectrumValue;
-
-/**
- * \brief The AmcModule class implements the Adaptive Modulation And Coding Scheme
- * as proposed in 3GPP TSG-RAN WG1 - R1-081483
- * http://www.3gpp.org/ftp/tsg_ran/WG1_RL1/TSGR1_52b/Docs/R1-081483.zip
- *
- * \note All the methods of this class are static, so you'll never
- * need to create and manage instances of this class.
- */
-class AmcModule
-{
-
-public:
- /**
- * \brief Initialize CQI, MCS, SpectralEfficiency e TBs values
- */
- static void Initialize ();
-
- /**
- * \brief Get the Modulation anc Coding Scheme for
- * a CQI value
- * \param cqi the cqi value
- * \return the MCS value
- */
- static int GetMcsFromCqi (int cqi);
-
- /**
- * \brief Get the Transport Block Size for a selected MCS
- * \param mcs the mcs index
- * \return the TBs value
- */
- static int GetTbSizeFromMcs (int mcs);
-
- /**
- * \brief Get the Transport Block Size for a selected MCS and number of PRB (table 7.1.7.2.1-1 of 36.213)
- * \param mcs the mcs index
- * \param nprb the no. of PRB
- * \return the TBs value
- */
- static int GetTbSizeFromMcs (int mcs, int nprb);
-
- /**
- * \brief Get the spectral efficiency value associated
- * to the received CQI
- * \param cqi the cqi value
- * \return the spectral efficiency value
- */
- static double GetSpectralEfficiencyFromCqi (int cqi);
-
- /**
- * \brief Create a message with CQI feedback
- *
- */
- static std::vector<int> CreateCqiFeedbacks (const SpectrumValue& sinr);
-
-private:
- /**
- * \brief Get a proper CQI for the spectrale efficiency value.
- * In order to assure a fewer block error rate, the AMC chooses the lower CQI value
- * for a given spectral efficiency
- * \param s the spectral efficiency
- * \return the CQI value
- */
- static int GetCqiFromSpectralEfficiency (double s);
-
-};
-
-
-}
-
-#endif /* AMCMODULE_H */
--- a/src/lte/model/enb-lte-spectrum-phy.cc Thu Mar 10 18:15:26 2011 +0100
+++ b/src/lte/model/enb-lte-spectrum-phy.cc Thu Mar 10 18:57:41 2011 +0100
@@ -80,7 +80,7 @@
*
* Downlink:
* the UE receives the signal from the eNB. It computes the SINR and tranfers
- * it to the UeNetDevice. The UeNetDevice, receiving SINR values, uses the AMC module to convert
+ * it to the LteUeNetDevice. The LteUeNetDevice, receiving SINR values, uses the AMC module to convert
* SINR to CQI. Then, it will send CQI feedback to the eNB.
*
* Uplink:
--- a/src/lte/model/enb-lte-spectrum-phy.h Thu Mar 10 18:15:26 2011 +0100
+++ b/src/lte/model/enb-lte-spectrum-phy.h Thu Mar 10 18:57:41 2011 +0100
@@ -27,7 +27,7 @@
namespace ns3 {
class LteNetDevice;
-class EnbNetDevice;
+class LteEnbNetDevice;
/**
* The EnbLteSpectrumPhy models the UL/DL physical layer for the eNodeB device
--- a/src/lte/model/enb-net-device.cc Thu Mar 10 18:15:26 2011 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,217 +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 <mmiozzo@cttc.es> : Update to FF API Architecture
- * Author: Nicola Baldo <nbaldo@cttc.es> : Integrated with new RRC and MAC architecture
- */
-
-#include "ns3/llc-snap-header.h"
-#include "ns3/simulator.h"
-#include "ns3/callback.h"
-#include "ns3/node.h"
-#include "ns3/packet.h"
-#include "lte-net-device.h"
-#include "ns3/packet-burst.h"
-#include "ns3/uinteger.h"
-#include "ns3/trace-source-accessor.h"
-#include "ns3/pointer.h"
-#include "ns3/enum.h"
-#include "amc-module.h"
-#include "lte-enb-mac.h"
-#include "enb-net-device.h"
-#include "lte-enb-rrc.h"
-#include "ue-net-device.h"
-#include "enb-phy.h"
-#include "rr-ff-mac-scheduler.h"
-
-NS_LOG_COMPONENT_DEFINE ("EnbNetDevice");
-
-namespace ns3 {
-
-NS_OBJECT_ENSURE_REGISTERED ( EnbNetDevice);
-
-uint16_t EnbNetDevice::m_cellIdCounter = 0;
-
-TypeId EnbNetDevice::GetTypeId (void)
-{
- static TypeId
- tid =
- TypeId ("ns3::EnbNetDevice")
- .SetParent<LteNetDevice> ();
- return tid;
-}
-
-EnbNetDevice::EnbNetDevice (void)
-{
- NS_LOG_FUNCTION (this);
- NS_FATAL_ERROR ("This constructor should not be called");
- InitEnbNetDevice ();
-}
-
-EnbNetDevice::EnbNetDevice (Ptr<Node> node, Ptr<EnbLtePhy> phy)
- : m_phy (phy)
-{
- NS_LOG_FUNCTION (this);
- InitEnbNetDevice ();
- SetNode (node);
-}
-
-EnbNetDevice::~EnbNetDevice (void)
-{
- NS_LOG_FUNCTION (this);
-}
-
-void
-EnbNetDevice::DoDispose ()
-{
- NS_LOG_FUNCTION (this);
-
- m_mac->Dispose ();
- m_mac = 0;
-
- m_rrc->Dispose ();
- m_rrc = 0;
-
- m_phy->Dispose ();
- m_phy = 0;
-
- LteNetDevice::DoDispose ();
-}
-
-
-void
-EnbNetDevice::InitEnbNetDevice (void)
-{
- NS_LOG_FUNCTION (this);
-
- m_mac = CreateObject<LteEnbMac> ();
- // m_mac->SetDevice (this->GetObject<LteNetDevice> ());
- SetNode (0);
- if (GetPhy () == 0)
- {
- NS_LOG_DEBUG (this << "PHY NULL");
- }
- else
- {
- NS_LOG_DEBUG (this << "PHY ! NULL");
- }
- m_rrc = Create<LteEnbRrc> ();
- m_rrc->SetLteEnbCmacSapProvider (m_mac->GetLteEnbCmacSapProvider ());
- m_mac->SetLteEnbCmacSapUser (m_rrc->GetLteEnbCmacSapUser ());
- m_rrc->SetLteMacSapProvider (m_mac->GetLteMacSapProvider ());
-
- m_scheduler = Create<RrFfMacScheduler> ();
- m_mac->SetFfMacSchedSapProvider (m_scheduler->GetFfMacSchedSapProvider ());
- m_mac->SetFfMacCschedSapProvider (m_scheduler->GetFfMacCschedSapProvider ());
-
- m_scheduler->SetFfMacSchedSapUser (m_mac->GetFfMacSchedSapUser ());
- m_scheduler->SetFfMacCschedSapUser (m_mac->GetFfMacCschedSapUser ());
-
- GetPhy ()->GetObject<EnbLtePhy> ()->SetLteEnbPhySapUser (m_mac->GetLteEnbPhySapUser ());
- m_mac->SetLteEnbPhySapProvider (GetPhy ()->GetObject<EnbLtePhy> ()->GetLteEnbPhySapProvider ());
-
- m_rrc->ConfigureCell (25, 25);
- NS_ASSERT_MSG (m_cellIdCounter < 65535, "max num eNBs exceeded");
- m_cellId = ++m_cellIdCounter;
-
- // WILD HACK - should use the PHY SAP instead. Probably should handle this through the RRC
- GetPhy ()->GetObject<EnbLtePhy> ()->DoSetBandwidth (25,25);
- GetPhy ()->GetObject<EnbLtePhy> ()->DoSetCellId (m_cellId);
-
- Simulator::ScheduleNow (&EnbLtePhy::StartFrame, GetPhy ()->GetObject<EnbLtePhy> ());
-}
-
-
-Ptr<LteEnbMac>
-EnbNetDevice::GetMac (void)
-{
- NS_LOG_FUNCTION (this);
- return m_mac;
-}
-
-
-Ptr<EnbLtePhy>
-EnbNetDevice::GetPhy (void) const
-{
- NS_LOG_FUNCTION (this);
- return m_phy;
-}
-
-
-bool
-EnbNetDevice::DoSend (Ptr<Packet> packet, const Mac48Address& source,
- const Mac48Address& dest, uint16_t protocolNumber)
-{
- NS_LOG_FUNCTION (this << source << dest << protocolNumber);
-
- NS_FATAL_ERROR ("IP connectivity not implemented yet");
-
- /*
- * The classification of traffic in DL is done by the PGW (not
- * by the eNB).
- * Hovever, the core network is not implemented yet.
- * For now the classification is managed by the eNB.
- */
-
- // if (protocolNumber == 2048)
- // {
- // // it is an IP packet
- // }
-
- // if (protocolNumber != 2048 || bearer == 0)
- // {
-
- // }
-
-
- return true;
-}
-
-
-void
-EnbNetDevice::DoReceive (Ptr<Packet> p)
-{
- NS_LOG_FUNCTION (this << p);
- ForwardUp (p->Copy ());
-}
-
-
-void
-EnbNetDevice::SendIdealPdcchMessage (void)
-{
- NS_LOG_FUNCTION (this);
- /*
- * Get both PDCCH ideal message for UL and DL and
- * set assigned resources to UEs using
- * SendAssignedDLResources and SendAssignedULResources
- */
-}
-
-Ptr<LteEnbRrc>
-EnbNetDevice::GetRrc ()
-{
- return m_rrc;
-}
-
-uint16_t
-EnbNetDevice::GetCellId ()
-{
- return m_cellId;
-}
-
-} // namespace ns3
--- a/src/lte/model/enb-net-device.h Thu Mar 10 18:15:26 2011 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,122 +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> : Update to FF API Architecture
- */
-
-#ifndef ENB_NET_DEVICE_H
-#define ENB_NET_DEVICE_H
-
-#include "lte-net-device.h"
-#include "ns3/event-id.h"
-#include "ns3/mac48-address.h"
-#include "ns3/traced-callback.h"
-#include "ns3/nstime.h"
-#include "ns3/log.h"
-#include "lte-phy.h"
-#include <vector>
-
-namespace ns3 {
-
-class Packet;
-class PacketBurst;
-class Node;
-class LtePhy;
-class EnbLtePhy;
-class LteEnbMac;
-class LteEnbRrc;
-class RrFfMacScheduler;
-
-
-/**
- * The eNodeB device implementation
- */
-class EnbNetDevice : public LteNetDevice
-{
-public:
- static TypeId GetTypeId (void);
-
- EnbNetDevice (void);
- /**
- * \brief Create eNB net device
- * \param node the network node
- * \param phy the physical object attache dto it
- */
- EnbNetDevice (Ptr<Node> node, Ptr<EnbLtePhy> phy);
-
- virtual ~EnbNetDevice (void);
- virtual void DoDispose (void);
-
- /**
- * \brief Initialize all parameters of this device
- */
- void InitEnbNetDevice (void);
-
- /**
- * \return a pointer to the MAC
- */
- Ptr<LteEnbMac> GetMac (void);
-
- /**
- * \return a pointer to the physical layer.
- */
- Ptr<EnbLtePhy> GetPhy (void) const;
-
-
-
- Ptr<LteEnbRrc> GetRrc ();
-
- /**
- * \brief Send the PDCCH ideal mesages under an
- * ideal control channel
- */
- void SendIdealPdcchMessage (void);
-
-
- /**
- *
- * \return the Cell Identifier of this eNB
- */
- uint16_t GetCellId ();
-
-private:
- bool DoSend (Ptr<Packet> packet,
- const Mac48Address& source,
- const Mac48Address& dest,
- uint16_t protocolNumber);
-
- void DoReceive (Ptr<Packet> p);
-
- // Ptr<UeManager> m_ueManager;
-
- Ptr<LteEnbMac> m_mac;
-
- Ptr<EnbLtePhy> m_phy;
-
- Ptr<LteEnbRrc> m_rrc;
-
- Ptr<RrFfMacScheduler> m_scheduler;
-
- uint16_t m_cellId; /**< Cell Identifer. Part of the CGI, see TS 29.274, section 8.21.1 */
-
- static uint16_t m_cellIdCounter;
-};
-
-} // namespace ns3
-
-#endif /* ENB_NET_DEVICE_H */
--- a/src/lte/model/enb-phy.cc Thu Mar 10 18:15:26 2011 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,375 +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 <mmiozzo@cttc.es>
- */
-
-#include <ns3/object-factory.h>
-#include <ns3/log.h>
-#include <math.h>
-#include <ns3/simulator.h>
-#include "ns3/spectrum-error-model.h"
-#include "enb-phy.h"
-#include "lte-net-device.h"
-#include "lte-spectrum-value-helper.h"
-#include "ideal-control-messages.h"
-#include "enb-net-device.h"
-#include "lte-enb-mac.h"
-
-
-NS_LOG_COMPONENT_DEFINE ("EnbLtePhy");
-
-namespace ns3 {
-
-
-////////////////////////////////////////
-// member SAP forwarders
-////////////////////////////////////////
-
-
-class EnbMemberLteEnbPhySapProvider : public LteEnbPhySapProvider
-{
-public:
- EnbMemberLteEnbPhySapProvider (EnbLtePhy* phy);
-
- // inherited from LteEnbPhySapProvider
- 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);
-
-private:
- EnbLtePhy* m_phy;
-};
-
-EnbMemberLteEnbPhySapProvider::EnbMemberLteEnbPhySapProvider (EnbLtePhy* phy) : m_phy (phy)
-{
-
-}
-
-
-void
-EnbMemberLteEnbPhySapProvider::SendMacPdu (Ptr<Packet> p)
-{
- m_phy->DoSendMacPdu (p);
-}
-
-void
-EnbMemberLteEnbPhySapProvider::SetBandwidth (uint8_t ulBandwidth, uint8_t dlBandwidth)
-{
- m_phy->DoSetBandwidth (ulBandwidth, dlBandwidth);
-}
-
-void
-EnbMemberLteEnbPhySapProvider::SetCellId (uint16_t cellId)
-{
- m_phy->DoSetCellId (cellId);
-}
-
-void
-EnbMemberLteEnbPhySapProvider::SendIdealControlMessage (Ptr<IdealControlMessage> msg)
-{
- m_phy->DoSendIdealControlMessage (msg);
-}
-
-
-////////////////////////////////////////
-// generic EnbLtePhy methods
-////////////////////////////////////////
-
-
-
-NS_OBJECT_ENSURE_REGISTERED (EnbLtePhy);
-
-
-EnbLtePhy::EnbLtePhy ()
- : m_nrFrames (0),
- m_nrSubFrames (0)
-{
- m_enbPhySapProvider = new EnbMemberLteEnbPhySapProvider (this);
-}
-
-
-TypeId
-EnbLtePhy::GetTypeId (void)
-{
- static TypeId tid = TypeId ("ns3::EnbLtePhy")
- .SetParent<LtePhy> ()
- .AddConstructor<EnbLtePhy> ()
- ;
- return tid;
-}
-
-
-EnbLtePhy::~EnbLtePhy ()
-{
-}
-
-void
-EnbLtePhy::SetLteEnbPhySapUser (LteEnbPhySapUser* s)
-{
- m_enbPhySapUser = s;
-}
-
-LteEnbPhySapProvider*
-EnbLtePhy::GetLteEnbPhySapProvider ()
-{
- return (m_enbPhySapProvider);
-}
-
-
-
-bool
-EnbLtePhy::AddUePhy (uint8_t rnti, Ptr<UeLtePhy> phy)
-{
- std::map <uint8_t, Ptr<UeLtePhy> >::iterator it;
- it = m_ueAttached.find (rnti);
- if (it == m_ueAttached.end ())
- {
- m_ueAttached.insert (std::pair<uint8_t, Ptr<UeLtePhy> > (rnti, phy));
- return (true);
- }
- else
- {
- NS_LOG_ERROR ("UE already attached");
- return (false);
- }
-}
-
-bool
-EnbLtePhy::DeleteUePhy (uint8_t rnti)
-{
- std::map <uint8_t, Ptr<UeLtePhy> >::iterator it;
- it = m_ueAttached.find (rnti);
- if (it == m_ueAttached.end ())
- {
- NS_LOG_ERROR ("UE not attached");
- return (false);
- }
- else
- {
- m_ueAttached.erase (it);
- return (true);
- }
-}
-
-
-
-void
-EnbLtePhy::DoSendMacPdu (Ptr<Packet> p)
-{
-// NS_LOG_FUNCTION (this << pb->GetNPackets () << pb->GetSize ());
-// return GetDownlinkSpectrumPhy ()->StartTx (pb);
-
- NS_LOG_FUNCTION (this);
- SetMacPdu (p);
-}
-
-
-void
-EnbLtePhy::PhyPduReceived (Ptr<Packet> p)
-{
- NS_LOG_FUNCTION (this);
- m_enbPhySapUser->ReceivePhyPdu (p);
-}
-
-void
-EnbLtePhy::DoSetDownlinkSubChannels ()
-{
- NS_LOG_FUNCTION (this);
- Ptr<SpectrumValue> txPsd = CreateTxPowerSpectralDensity ();
- GetDownlinkSpectrumPhy ()->SetTxPowerSpectralDensity (txPsd);
-}
-
-
-Ptr<SpectrumValue>
-EnbLtePhy::CreateTxPowerSpectralDensity ()
-{
- NS_LOG_FUNCTION (this);
-
- LteSpectrumValueHelper psdHelper;
- Ptr<SpectrumValue> psd = psdHelper.CreateDownlinkTxPowerSpectralDensity (GetTxPower (), GetDownlinkSubChannels ());
-
- return psd;
-}
-
-
-void
-EnbLtePhy::CalcChannelQualityForUe (std::vector <double> sinr, Ptr<LteSpectrumPhy> ue)
-{
- NS_LOG_FUNCTION (this);
-}
-
-
-void
-EnbLtePhy::DoSendIdealControlMessage (Ptr<IdealControlMessage> msg)
-{
- NS_LOG_FUNCTION (this << msg);
- // queues the message (wait for MAC-PHY delay)
- SetControlMessages (msg);
-}
-
-
-
-void
-EnbLtePhy::ReceiveIdealControlMessage (Ptr<IdealControlMessage> msg)
-{
- NS_LOG_FUNCTION (this << msg);
- m_enbPhySapUser->ReceiveIdealControlMessage (msg);
-}
-
-
-
-void
-EnbLtePhy::StartFrame (void)
-{
- NS_LOG_FUNCTION (this);
-
- ++m_nrFrames;
- NS_LOG_INFO ("-----frame " << m_nrFrames << "-----");
- m_nrSubFrames = 0;
- StartSubFrame ();
-}
-
-
-void
-EnbLtePhy::StartSubFrame (void)
-{
- NS_LOG_FUNCTION (this);
-
- ++m_nrSubFrames;
- NS_LOG_INFO ("-----sub frame " << m_nrSubFrames << "-----");
-
- // send the current burst of control messages
- std::list<Ptr<IdealControlMessage> > ctrlMsg = GetControlMessages ();
- std::vector <int> dlRb;
- if (ctrlMsg.size () > 0)
- {
- std::list<Ptr<IdealControlMessage> >::iterator it;
- it = ctrlMsg.begin ();
- while (it != ctrlMsg.end ())
- {
- Ptr<IdealControlMessage> msg = (*it);
- if (msg->GetMessageType () == IdealControlMessage::DL_DCI)
- {
- std::map <uint8_t, Ptr<UeLtePhy> >::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
- {
- // get the tx power spectral density according to DL-DCI(s)
- // translate the DCI to Spectrum framework
- uint32_t mask = 0x1;
- for (int i = 0; i < 32; i++)
- {
- if (((dci->GetDci ().m_rbBitmap & mask) >> i) == 1)
- {
- for (int k = 0; k < GetRbgSize (); k++)
- {
- dlRb.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)
- {
- std::map <uint8_t, Ptr<UeLtePhy> >::iterator it2;
- Ptr<UlDciIdealControlMessage> dci = DynamicCast<UlDciIdealControlMessage> (msg);
- it2 = m_ueAttached.find (dci->GetDci ().m_rnti);
-
- if (it2 == m_ueAttached.end ())
- {
- NS_LOG_ERROR ("UE not attached");
- }
- else
- {
- (*it2).second->ReceiveIdealControlMessage (msg);
- }
- }
- ctrlMsg.pop_front ();
- it = ctrlMsg.begin ();
- }
- }
- // set the current tx power spectral density
- SetDownlinkSubChannels (dlRb);
- // send the current burts of packets
- Ptr<PacketBurst> pb = GetPacketBurst ();
- if (pb)
- {
- GetDownlinkSpectrumPhy ()->StartTx (pb);
- }
-
- // trigger the MAC
- Ptr<LteEnbMac> macEntity = GetDevice ()->GetObject<EnbNetDevice> ()->GetMac ();
-
- m_enbPhySapUser->SubframeIndication (m_nrFrames, m_nrSubFrames);
-
-
- // trigger the UE(s)
- std::map <uint8_t, Ptr<UeLtePhy> >::iterator it;
- for (it = m_ueAttached.begin (); it != m_ueAttached.end (); it++)
- {
- (*it).second->SubframeIndication (m_nrFrames, m_nrSubFrames);
- }
-
- Simulator::Schedule (Seconds (GetTti ()),
- &EnbLtePhy::EndSubFrame,
- this);
-
-}
-
-
-void
-EnbLtePhy::EndSubFrame (void)
-{
- NS_LOG_FUNCTION (this << Simulator::Now ().GetSeconds ());
- if (m_nrSubFrames == 10)
- {
- Simulator::ScheduleNow (&EnbLtePhy::EndFrame, this);
- }
- else
- {
- Simulator::ScheduleNow (&EnbLtePhy::StartSubFrame, this);
- }
-}
-
-
-void
-EnbLtePhy::EndFrame (void)
-{
- NS_LOG_FUNCTION (this << Simulator::Now ().GetSeconds ());
- Simulator::ScheduleNow (&EnbLtePhy::StartFrame, this);
-}
-
-
-void
-EnbLtePhy::GenerateCqiFeedback (const SpectrumValue& sinr)
-{
- NS_LOG_FUNCTION (this << sinr);
-}
-
-};
--- a/src/lte/model/enb-phy.h Thu Mar 10 18:15:26 2011 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,149 +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 ENB_LTE_PHY_H
-#define ENB_LTE_PHY_H
-
-
-#include "lte-phy.h"
-#include <ns3/lte-enb-phy-sap.h>
-#include <map>
-#include <ns3/ue-phy.h>
-
-namespace ns3 {
-
-class PacketBurst;
-class LteNetDevice;
-
-/**
- * EnbLtePhy models the physical layer for the eNodeB
- */
-class EnbLtePhy : public LtePhy
-{
-
- friend class EnbMemberLteEnbPhySapProvider;
-
-public:
- EnbLtePhy ();
-
- /**
- * \brief Create the eNB phy layer
- * \param d the device where the phy layer is attached
- */
- EnbLtePhy (Ptr<LteNetDevice> d);
- virtual ~EnbLtePhy ();
-
- static TypeId GetTypeId (void);
-
-
- /**
- * \brief Get the PHY SAP provider
- * \return a pointer to the SAP Provider of the PHY
- */
- LteEnbPhySapProvider* GetLteEnbPhySapProvider ();
-
- /**
- * \brief Set the PHY SAP User
- * \param s a pointer to the PHY SAP user
- */
- void SetLteEnbPhySapUser (LteEnbPhySapUser* s);
-
-
- /**
- * \brief Queue the MAC PDU to be sent
- * \param p the MAC PDU to sent
- */
- virtual void DoSendMacPdu (Ptr<Packet> p);
-
-
- void DoSetDownlinkSubChannels ();
-
- /**
- * \brief Create the PSD for TX
- */
- virtual Ptr<SpectrumValue> CreateTxPowerSpectralDensity ();
-
- /**
- * \brief Calculate the channel quality for a given UE
- * \param sinr a list of computed SINR
- * \param ue the UE
- */
- 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);
-
-
- void DoSendIdealControlMessage (Ptr<IdealControlMessage> msg);
-
- bool AddUePhy (uint8_t rnti, Ptr<UeLtePhy> phy);
-
- bool DeleteUePhy (uint8_t rnti);
-
-
- /**
- * \brief Start a LTE frame
- */
- void StartFrame (void);
- /**
- * \brief Start a LTE sub frame
- */
- void StartSubFrame (void);
- /**
- * \brief End a LTE sub frame
- */
- void EndSubFrame (void);
- /**
- * \brief End a LTE frame
- */
- void EndFrame (void);
-
- /**
- * \brief PhySpectrum received a new PHY-PDU
- */
- void PhyPduReceived (Ptr<Packet> p);
-
- // inherited from LtePhy
- virtual void GenerateCqiFeedback (const SpectrumValue& sinr);
-
-
-private:
- std::map <uint8_t, Ptr<UeLtePhy> > m_ueAttached;
-
- LteEnbPhySapProvider* m_enbPhySapProvider;
- LteEnbPhySapUser* m_enbPhySapUser;
-
- uint32_t m_nrFrames;
- uint32_t m_nrSubFrames;
-};
-
-
-}
-
-#endif /* ENB_PHY_H */
--- a/src/lte/model/ideal-control-messages.cc Thu Mar 10 18:15:26 2011 +0100
+++ b/src/lte/model/ideal-control-messages.cc Thu Mar 10 18:57:41 2011 +0100
@@ -24,7 +24,7 @@
#include "ns3/uinteger.h"
#include "ns3/log.h"
#include "lte-net-device.h"
-#include "ue-net-device.h"
+#include "lte-ue-net-device.h"
NS_LOG_COMPONENT_DEFINE ("IdealControlMessage");
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/lte/model/lte-amc.cc Thu Mar 10 18:57:41 2011 +0100
@@ -0,0 +1,326 @@
+/* -*- 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
+ *
+ * Original Author: Giuseppe Piro <g.piro@poliba.it>
+ * Modified by: Marco Miozzo <mmiozzo@cttc.es>
+ * Nicola Baldo <nbaldo@cttc.es>
+ */
+
+
+#include "lte-amc.h"
+#include <ns3/log.h>
+#include <ns3/assert.h>
+#include <math.h>
+#include <ns3/spectrum-value.h>
+
+NS_LOG_COMPONENT_DEFINE ("LteAmc");
+
+namespace ns3 {
+
+
+int CqiIndex[15] = {
+ 1, 2, 3, 4, 5, 6, // QAM
+ 7, 8, 9, // 4-QAM
+ 10, 11, 12, 13, 14, 15 // 16QAM
+};
+
+
+double SpectralEfficiencyForCqiIndex[15] = {
+ 0.15, 0.23, 0.38, 0.6, 0.88, 1.18,
+ 1.48, 1.91, 2.41,
+ 2.73, 3.32, 3.9, 4.52, 5.12, 5.55
+};
+
+int McsIndex[32] = {
+ 0, // RESERVED
+ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, // QAM
+ 12, 13, 14, 15, 16, 17, 18, // 4-QAM
+ 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, // 16-QAM
+ 30, // QAM, RESERVED
+ 31 // RESERVED
+};
+
+// legacy table
+// int ModulationSchemeForMcsIndex[32] = {
+// 0, // Not defined
+// 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+// 4, 4, 4, 4, 4, 4, 4,
+// 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
+// 2,
+// 0 // Not defined
+// };
+
+// Table 7.1.7.1-1 of 36.213 v8.6.0
+int ModulationSchemeForMcsIndex[32] = {
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 4, 4, 4, 4, 4, 4, 4,
+ 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
+ 2, // reserved
+ 4, // reserved
+ 6, // reserved
+};
+
+// legacy table
+// double SpectralEfficiencyForMcsIndex[32] = {
+// 0,
+// 0.15, 0.19, 0.23, 0.31, 0.38, 0.49, 0.6, 0.74, 0.88, 1.03, 1.18,
+// 1.33, 1.48, 1.7, 1.91, 2.16, 2.41, 2.57,
+// 2.73, 3.03, 3.32, 3.61, 3.9, 4.21, 4.52, 4.82, 5.12, 5.33, 5.55,
+// 2.4,
+// 0
+// };
+
+
+double SpectralEfficiencyForMcsIndex[32] = {
+ 0.15, 0.19, 0.23, 0.31, 0.38, 0.49, 0.6, 0.74, 0.88, 1.03, 1.18,
+ 1.33, 1.48, 1.7, 1.91, 2.16, 2.41, 2.57,
+ 2.73, 3.03, 3.32, 3.61, 3.9, 4.21, 4.52, 4.82, 5.12, 5.33, 5.55,
+ 0, 0, 0
+};
+
+
+int TransportBlockSize[32] = {
+ 0,
+ 18, 23, 28, 37, 45, 59, 72, 89, 105, 123, 141,
+ 159, 177, 203, 230, 259, 289, 288,
+ 308, 328, 363, 399, 433, 468, 506, 543, 578, 614, 640,
+ 667,
+ 0
+};
+
+int McsToItbs[29] = {
+ 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
+};
+
+
+int TransportBlockSizeTable [110][27] = {
+
+ /* NPRB 001*/ { 16, 24, 32, 40, 56, 72, 328, 104, 120, 136, 144, 176, 208, 224, 256, 280, 328, 336, 376, 408, 440, 488, 520, 552, 584, 616, 712},
+ /* NPRB 002*/ { 32, 56, 72, 104, 120, 144, 176, 224, 256, 296, 328, 376, 440, 488, 552, 600, 632, 696, 776, 840, 904, 1000, 1064, 1128, 1192, 1256, 1480},
+ /* NPRB 003*/ { 56, 88, 144, 176, 208, 224, 256, 328, 392, 456, 504, 584, 680, 744, 840, 904, 968, 1064, 1160, 1288, 1384, 1480, 1608, 1736, 1800, 1864, 2216},
+ /* NPRB 004*/ { 88, 144, 176, 208, 256, 328, 392, 472, 536, 616, 680, 776, 904, 1000, 1128, 1224, 1288, 1416, 1544, 1736, 1864, 1992, 2152, 2280, 2408, 2536, 2984},
+ /* NPRB 005*/ { 120, 176, 208, 256, 328, 424, 504, 584, 680, 776, 872, 1000, 1128, 1256, 1416, 1544, 1608, 1800, 1992, 2152, 2344, 2472, 2664, 2856, 2984, 3112, 3752},
+ /* NPRB 006*/ { 152, 208, 256, 328, 408, 504, 600, 712, 808, 936, 1032, 1192, 1352, 1544, 1736, 1800, 1928, 2152, 2344, 2600, 2792, 2984, 3240, 3496, 3624, 3752, 4392},
+ /* NPRB 007*/ { 176, 224, 296, 392, 488, 600, 712, 840, 968, 1096, 1224, 1384, 1608, 1800, 1992, 2152, 2280, 2536, 2792, 2984, 3240, 3496, 3752, 4008, 4264, 4392, 5160},
+ /* NPRB 008*/ { 208, 256, 328, 440, 552, 680, 808, 968, 1096, 1256, 1384, 1608, 1800, 2024, 2280, 2472, 2600, 2856, 3112, 3496, 3752, 4008, 4264, 4584, 4968, 5160, 5992},
+ /* NPRB 009*/ { 224, 328, 376, 504, 632, 776, 936, 1096, 1256, 1416, 1544, 1800, 2024, 2280, 2600, 2728, 2984, 3240, 3624, 3880, 4136, 4584, 4776, 5160, 5544, 5736, 6712},
+ /* NPRB 010*/ { 256, 344, 424, 568, 696, 872, 1032, 1224, 1384, 1544, 1736, 2024, 2280, 2536, 2856, 3112, 3240, 3624, 4008, 4264, 4584, 4968, 5352, 5736, 5992, 6200, 7480},
+ /* NPRB 011*/ { 288, 376, 472, 616, 776, 968, 1128, 1320, 1544, 1736, 1928, 2216, 2472, 2856, 3112, 3368, 3624, 4008, 4392, 4776, 5160, 5544, 5992, 6200, 6712, 6968, 8248},
+ /* NPRB 012*/ { 328, 424, 520, 680, 840, 1032, 1224, 1480, 1672, 1864, 2088, 2408, 2728, 3112, 3496, 3624, 3880, 4392, 4776, 5160, 5544, 5992, 6456, 6968, 7224, 7480, 8760},
+ /* NPRB 013*/ { 344, 456, 568, 744, 904, 1128, 1352, 1608, 1800, 2024, 2280, 2600, 2984, 3368, 3752, 4008, 4264, 4776, 5160, 5544, 5992, 6456, 6968, 7480, 7992, 8248, 9528},
+ /* NPRB 014*/ { 376, 488, 616, 808, 1000, 1224, 1480, 1672, 1928, 2216, 2472, 2792, 3240, 3624, 4008, 4264, 4584, 5160, 5544, 5992, 6456, 6968, 7480, 7992, 8504, 8760, 10296},
+ /* NPRB 015*/ { 392, 520, 648, 872, 1064, 1320, 1544, 1800, 2088, 2344, 2664, 2984, 3368, 3880, 4264, 4584, 4968, 5352, 5992, 6456, 6968, 7480, 7992, 8504, 9144, 9528, 11064},
+ /* NPRB 016*/ { 424, 568, 696, 904, 1128, 1384, 1672, 1928, 2216, 2536, 2792, 3240, 3624, 4136, 4584, 4968, 5160, 5736, 6200, 6968, 7480, 7992, 8504, 9144, 9912, 10296, 11832},
+ /* NPRB 017*/ { 456, 600, 744, 968, 1192, 1480, 1736, 2088, 2344, 2664, 2984, 3496, 3880, 4392, 4968, 5160, 5544, 6200, 6712, 7224, 7992, 8504, 9144, 9912, 10296, 10680, 12576},
+ /* NPRB 018*/ { 488, 632, 776, 1032, 1288, 1544, 1864, 2216, 2536, 2856, 3112, 3624, 4136, 4584, 5160, 5544, 5992, 6456, 7224, 7736, 8248, 9144, 9528, 10296, 11064, 11448, 13536},
+ /* NPRB 019*/ { 504, 680, 840, 1096, 1352, 1672, 1992, 2344, 2664, 2984, 3368, 3880, 4392, 4968, 5544, 5736, 6200, 6712, 7480, 8248, 8760, 9528, 10296, 11064, 11448, 12216, 14112},
+ /* NPRB 020*/ { 536, 712, 872, 1160, 1416, 1736, 2088, 2472, 2792, 3112, 3496, 4008, 4584, 5160, 5736, 6200, 6456, 7224, 7992, 8504, 9144, 9912, 10680, 11448, 12216, 12576, 14688},
+ /* NPRB 021*/ { 568, 744, 936, 1224, 1480, 1864, 2216, 2536, 2984, 3368, 3752, 4264, 4776, 5352, 5992, 6456, 6712, 7480, 8248, 9144, 9912, 10680, 11448, 12216, 12960, 13536, 15264},
+ /* NPRB 022*/ { 600, 776, 968, 1256, 1544, 1928, 2280, 2664, 3112, 3496, 3880, 4392, 4968, 5736, 6200, 6712, 7224, 7992, 8760, 9528, 10296, 11064, 11832, 12576, 13536, 14112, 16416},
+ /* NPRB 023*/ { 616, 808, 1000, 1320, 1608, 2024, 2408, 2792, 3240, 3624, 4008, 4584, 5352, 5992, 6456, 6968, 7480, 8248, 9144, 9912, 10680, 11448, 12576, 12960, 14112, 14688, 16992},
+ /* NPRB 024*/ { 648, 872, 1064, 1384, 1736, 2088, 2472, 2984, 3368, 3752, 4264, 4776, 5544, 6200, 6968, 7224, 7736, 8760, 9528, 10296, 11064, 12216, 12960, 13536, 14688, 15264, 17568},
+ /* NPRB 025*/ { 680, 904, 1096, 1416, 1800, 2216, 2600, 3112, 3496, 4008, 4392, 4968, 5736, 6456, 7224, 7736, 7992, 9144, 9912, 10680, 11448, 12576, 13536, 14112, 15264, 15840, 18336},
+ /* NPRB 026*/ { 712, 936, 1160, 1480, 1864, 2280, 2728, 3240, 3624, 4136, 4584, 5352, 5992, 6712, 7480, 7992, 8504, 9528, 10296, 11064, 12216, 12960, 14112, 14688, 15840, 16416, 19080},
+ /* NPRB 027*/ { 744, 968, 1192, 1544, 1928, 2344, 2792, 3368, 3752, 4264, 4776, 5544, 6200, 6968, 7736, 8248, 8760, 9912, 10680, 11448, 12576, 13536, 14688, 15264, 16416, 16992, 19848},
+ /* NPRB 028*/ { 776, 1000, 1256, 1608, 1992, 2472, 2984, 3368, 3880, 4392, 4968, 5736, 6456, 7224, 7992, 8504, 9144, 10296, 11064, 12216, 12960, 14112, 15264, 15840, 16992, 17568, 20616},
+ /* NPRB 029*/ { 776, 1032, 1288, 1672, 2088, 2536, 2984, 3496, 4008, 4584, 5160, 5992, 6712, 7480, 8248, 8760, 9528, 10296, 11448, 12576, 13536, 14688, 15840, 16416, 17568, 18336, 21384},
+ /* NPRB 030*/ { 808, 1064, 1320, 1736, 2152, 2664, 3112, 3624, 4264, 4776, 5352, 5992, 6712, 7736, 8504, 9144, 9912, 10680, 11832, 12960, 14112, 15264, 16416, 16992, 18336, 19080, 22152},
+ /* NPRB 031*/ { 840, 1128, 1384, 1800, 2216, 2728, 3240, 3752, 4392, 4968, 5544, 6200, 6968, 7992, 8760, 9528, 9912, 11064, 12216, 13536, 14688, 15840, 16992, 17568, 19080, 19848, 22920},
+ /* NPRB 032*/ { 872, 1160, 1416, 1864, 2280, 2792, 3368, 3880, 4584, 5160, 5736, 6456, 7224, 8248, 9144, 9912, 10296, 11448, 12576, 13536, 14688, 15840, 16992, 18336, 19848, 20616, 23688},
+ /* NPRB 033*/ { 904, 1192, 1480, 1928, 2344, 2856, 3496, 4008, 4584, 5160, 5736, 6712, 7480, 8504, 9528, 10296, 10680, 11832, 12960, 14112, 15264, 16416, 17568, 19080, 19848, 20616, 24496},
+ /* NPRB 034*/ { 936, 1224, 1544, 1992, 2408, 2984, 3496, 4136, 4776, 5352, 5992, 6968, 7736, 8760, 9912, 10296, 11064, 12216, 13536, 14688, 15840, 16992, 18336, 19848, 20616, 21384, 25456},
+ /* NPRB 035*/ { 968, 1256, 1544, 2024, 2472, 3112, 3624, 4264, 4968, 5544, 6200, 6968, 7992, 9144, 9912, 10680, 11448, 12576, 14112, 15264, 16416, 17568, 19080, 19848, 21384, 22152, 25456},
+ /* NPRB 036*/ { 1000, 1288, 1608, 2088, 2600, 3112, 3752, 4392, 4968, 5736, 6200, 7224, 8248, 9144, 10296, 11064, 11832, 12960, 14112, 15264, 16992, 18336, 19080, 20616, 22152, 22920, 26416},
+ /* NPRB 037*/ { 1032, 1352, 1672, 2152, 2664, 3240, 3880, 4584, 5160, 5736, 6456, 7480, 8504, 9528, 10680, 11448, 12216, 13536, 14688, 15840, 16992, 18336, 19848, 21384, 22920, 23688, 27376},
+ /* NPRB 038*/ { 1032, 1384, 1672, 2216, 2728, 3368, 4008, 4584, 5352, 5992, 6712, 7736, 8760, 9912, 11064, 11832, 12216, 13536, 15264, 16416, 17568, 19080, 20616, 22152, 22920, 24496, 28336},
+ /* NPRB 039*/ { 1064, 1416, 1736, 2280, 2792, 3496, 4136, 4776, 5544, 6200, 6712, 7736, 8760, 9912, 11064, 11832, 12576, 14112, 15264, 16992, 18336, 19848, 21384, 22152, 23688, 24496, 29296},
+ /* NPRB 040*/ { 1096, 1416, 1800, 2344, 2856, 3496, 4136, 4968, 5544, 6200, 6968, 7992, 9144, 10296, 11448, 12216, 12960, 14688, 15840, 16992, 18336, 19848, 21384, 22920, 24496, 25456, 29296},
+ /* NPRB 041*/ { 1128, 1480, 1800, 2408, 2984, 3624, 4264, 4968, 5736, 6456, 7224, 8248, 9528, 10680, 11832, 12576, 13536, 14688, 16416, 17568, 19080, 20616, 22152, 23688, 25456, 26416, 30576},
+ /* NPRB 042*/ { 1160, 1544, 1864, 2472, 2984, 3752, 4392, 5160, 5992, 6712, 7480, 8504, 9528, 10680, 12216, 12960, 13536, 15264, 16416, 18336, 19848, 21384, 22920, 24496, 25456, 26416, 30576},
+ /* NPRB 043*/ { 1192, 1544, 1928, 2536, 3112, 3752, 4584, 5352, 5992, 6712, 7480, 8760, 9912, 11064, 12216, 12960, 14112, 15264, 16992, 18336, 19848, 21384, 22920, 24496, 26416, 27376, 31704},
+ /* NPRB 044*/ { 1224, 1608, 1992, 2536, 3112, 3880, 4584, 5352, 6200, 6968, 7736, 8760, 9912, 11448, 12576, 13536, 14112, 15840, 17568, 19080, 20616, 22152, 23688, 25456, 26416, 28336, 32856},
+ /* NPRB 045*/ { 1256, 1608, 2024, 2600, 3240, 4008, 4776, 5544, 6200, 6968, 7992, 9144, 10296, 11448, 12960, 13536, 14688, 16416, 17568, 19080, 20616, 22920, 24496, 25456, 27376, 28336, 32856},
+ /* NPRB 046*/ { 1256, 1672, 2088, 2664, 3240, 4008, 4776, 5736, 6456, 7224, 7992, 9144, 10680, 11832, 12960, 14112, 14688, 16416, 18336, 19848, 21384, 22920, 24496, 26416, 28336, 29296, 34008},
+ /* NPRB 047*/ { 1288, 1736, 2088, 2728, 3368, 4136, 4968, 5736, 6456, 7480, 8248, 9528, 10680, 12216, 13536, 14688, 15264, 16992, 18336, 20616, 22152, 23688, 25456, 27376, 28336, 29296, 35160},
+ /* NPRB 048*/ { 1320, 1736, 2152, 2792, 3496, 4264, 4968, 5992, 6712, 7480, 8504, 9528, 11064, 12216, 13536, 14688, 15840, 17568, 19080, 20616, 22152, 24496, 25456, 27376, 29296, 30576, 35160},
+ /* NPRB 049*/ { 1352, 1800, 2216, 2856, 3496, 4392, 5160, 5992, 6968, 7736, 8504, 9912, 11064, 12576, 14112, 15264, 15840, 17568, 19080, 21384, 22920, 24496, 26416, 28336, 29296, 31704, 36696},
+ /* NPRB 050*/ { 1384, 1800, 2216, 2856, 3624, 4392, 5160, 6200, 6968, 7992, 8760, 9912, 11448, 12960, 14112, 15264, 16416, 18336, 19848, 21384, 22920, 25456, 27376, 28336, 30576, 31704, 36696},
+ /* NPRB 051*/ { 1416, 1864, 2280, 2984, 3624, 4584, 5352, 6200, 7224, 7992, 9144, 10296, 11832, 12960, 14688, 15840, 16416, 18336, 19848, 22152, 23688, 25456, 27376, 29296, 31704, 32856, 37888},
+ /* NPRB 052*/ { 1416, 1864, 2344, 2984, 3752, 4584, 5352, 6456, 7224, 8248, 9144, 10680, 11832, 13536, 14688, 15840, 16992, 19080, 20616, 22152, 24496, 26416, 28336, 29296, 31704, 32856, 37888},
+ /* NPRB 053*/ { 1480, 1928, 2344, 3112, 3752, 4776, 5544, 6456, 7480, 8248, 9144, 10680, 12216, 13536, 15264, 16416, 16992, 19080, 21384, 22920, 24496, 26416, 28336, 30576, 32856, 34008, 39232},
+ /* NPRB 054*/ { 1480, 1992, 2408, 3112, 3880, 4776, 5736, 6712, 7480, 8504, 9528, 11064, 12216, 14112, 15264, 16416, 17568, 19848, 21384, 22920, 25456, 27376, 29296, 30576, 32856, 34008, 40576},
+ /* NPRB 055*/ { 1544, 1992, 2472, 3240, 4008, 4776, 5736, 6712, 7736, 8760, 9528, 11064, 12576, 14112, 15840, 16992, 17568, 19848, 22152, 23688, 25456, 27376, 29296, 31704, 34008, 35160, 40576},
+ /* NPRB 056*/ { 1544, 2024, 2536, 3240, 4008, 4968, 5992, 6712, 7736, 8760, 9912, 11448, 12576, 14688, 15840, 16992, 18336, 20616, 22152, 24496, 26416, 28336, 30576, 31704, 34008, 35160, 40576},
+ /* NPRB 057*/ { 1608, 2088, 2536, 3368, 4136, 4968, 5992, 6968, 7992, 9144, 9912, 11448, 12960, 14688, 16416, 17568, 18336, 20616, 22920, 24496, 26416, 28336, 30576, 32856, 35160, 36696, 42368},
+ /* NPRB 058*/ { 1608, 2088, 2600, 3368, 4136, 5160, 5992, 6968, 7992, 9144, 10296, 11832, 12960, 14688, 16416, 17568, 19080, 20616, 22920, 25456, 27376, 29296, 31704, 32856, 35160, 36696, 42368},
+ /* NPRB 059*/ { 1608, 2152, 2664, 3496, 4264, 5160, 6200, 7224, 8248, 9144, 10296, 11832, 13536, 15264, 16992, 18336, 19080, 21384, 23688, 25456, 27376, 29296, 31704, 34008, 36696, 37888, 43816},
+ /* NPRB 060*/ { 1672, 2152, 2664, 3496, 4264, 5352, 6200, 7224, 8504, 9528, 10680, 12216, 13536, 15264, 16992, 18336, 19848, 21384, 23688, 25456, 28336, 30576, 32856, 34008, 36696, 37888, 43816},
+ /* NPRB 061*/ { 1672, 2216, 2728, 3624, 4392, 5352, 6456, 7480, 8504, 9528, 10680, 12216, 14112, 15840, 17568, 18336, 19848, 22152, 24496, 26416, 28336, 30576, 32856, 35160, 36696, 39232, 45352},
+ /* NPRB 062*/ { 1736, 2280, 2792, 3624, 4392, 5544, 6456, 7480, 8760, 9912, 11064, 12576, 14112, 15840, 17568, 19080, 19848, 22152, 24496, 26416, 29296, 31704, 34008, 35160, 37888, 39232, 45352},
+ /* NPRB 063*/ { 1736, 2280, 2856, 3624, 4584, 5544, 6456, 7736, 8760, 9912, 11064, 12576, 14112, 16416, 18336, 19080, 20616, 22920, 24496, 27376, 29296, 31704, 34008, 36696, 37888, 40576, 46888},
+ /* NPRB 064*/ { 1800, 2344, 2856, 3752, 4584, 5736, 6712, 7736, 9144, 10296, 11448, 12960, 14688, 16416, 18336, 19848, 20616, 22920, 25456, 27376, 29296, 31704, 34008, 36696, 39232, 40576, 46888},
+ /* NPRB 065*/ { 1800, 2344, 2856, 3752, 4584, 5736, 6712, 7992, 9144, 10296, 11448, 12960, 14688, 16992, 18336, 19848, 21384, 23688, 25456, 28336, 30576, 32856, 35160, 37888, 39232, 40576, 48936},
+ /* NPRB 066*/ { 1800, 2408, 2984, 3880, 4776, 5736, 6968, 7992, 9144, 10296, 11448, 13536, 15264, 16992, 19080, 20616, 21384, 23688, 26416, 28336, 30576, 32856, 35160, 37888, 40576, 42368, 48936},
+ /* NPRB 067*/ { 1864, 2472, 2984, 3880, 4776, 5992, 6968, 8248, 9528, 10680, 11832, 13536, 15264, 16992, 19080, 20616, 22152, 24496, 26416, 29296, 31704, 34008, 36696, 37888, 40576, 42368, 48936},
+ /* NPRB 068*/ { 1864, 2472, 3112, 4008, 4968, 5992, 6968, 8248, 9528, 10680, 11832, 13536, 15264, 17568, 19848, 20616, 22152, 24496, 27376, 29296, 31704, 34008, 36696, 39232, 42368, 43816, 51024},
+ /* NPRB 069*/ { 1928, 2536, 3112, 4008, 4968, 5992, 7224, 8504, 9528, 11064, 12216, 14112, 15840, 17568, 19848, 21384, 22152, 24496, 27376, 29296, 31704, 35160, 36696, 39232, 42368, 43816, 51024},
+ /* NPRB 070*/ { 1928, 2536, 3112, 4136, 4968, 6200, 7224, 8504, 9912, 11064, 12216, 14112, 15840, 18336, 19848, 21384, 22920, 25456, 27376, 30576, 32856, 35160, 37888, 40576, 42368, 43816, 52752},
+ /* NPRB 071*/ { 1992, 2600, 3240, 4136, 5160, 6200, 7480, 8760, 9912, 11064, 12576, 14112, 16416, 18336, 20616, 22152, 22920, 25456, 28336, 30576, 32856, 35160, 37888, 40576, 43816, 45352, 52752},
+ /* NPRB 072*/ { 1992, 2600, 3240, 4264, 5160, 6200, 7480, 8760, 9912, 11448, 12576, 14688, 16416, 18336, 20616, 22152, 23688, 26416, 28336, 30576, 34008, 36696, 39232, 40576, 43816, 45352, 52752},
+ /* NPRB 073*/ { 2024, 2664, 3240, 4264, 5160, 6456, 7736, 8760, 10296, 11448, 12960, 14688, 16416, 19080, 20616, 22152, 23688, 26416, 29296, 31704, 34008, 36696, 39232, 42368, 45352, 46888, 55056},
+ /* NPRB 074*/ { 2088, 2728, 3368, 4392, 5352, 6456, 7736, 9144, 10296, 11832, 12960, 14688, 16992, 19080, 21384, 22920, 24496, 26416, 29296, 31704, 34008, 36696, 40576, 42368, 45352, 46888, 55056},
+ /* NPRB 075*/ { 2088, 2728, 3368, 4392, 5352, 6712, 7736, 9144, 10680, 11832, 12960, 15264, 16992, 19080, 21384, 22920, 24496, 27376, 29296, 32856, 35160, 37888, 40576, 43816, 45352, 46888, 55056},
+ /* NPRB 076*/ { 2088, 2792, 3368, 4392, 5544, 6712, 7992, 9144, 10680, 11832, 13536, 15264, 17568, 19848, 22152, 23688, 24496, 27376, 30576, 32856, 35160, 37888, 40576, 43816, 46888, 48936, 55056},
+ /* NPRB 077*/ { 2152, 2792, 3496, 4584, 5544, 6712, 7992, 9528, 10680, 12216, 13536, 15840, 17568, 19848, 22152, 23688, 25456, 27376, 30576, 32856, 35160, 39232, 42368, 43816, 46888, 48936, 57336},
+ /* NPRB 078*/ { 2152, 2856, 3496, 4584, 5544, 6968, 8248, 9528, 11064, 12216, 13536, 15840, 17568, 19848, 22152, 23688, 25456, 28336, 30576, 34008, 36696, 39232, 42368, 45352, 46888, 48936, 57336},
+ /* NPRB 079*/ { 2216, 2856, 3496, 4584, 5736, 6968, 8248, 9528, 11064, 12576, 14112, 15840, 18336, 20616, 22920, 24496, 25456, 28336, 31704, 34008, 36696, 39232, 42368, 45352, 48936, 51024, 57336},
+ /* NPRB 080*/ { 2216, 2856, 3624, 4776, 5736, 6968, 8248, 9912, 11064, 12576, 14112, 16416, 18336, 20616, 22920, 24496, 26416, 29296, 31704, 34008, 36696, 40576, 43816, 45352, 48936, 51024, 59256},
+ /* NPRB 081*/ { 2280, 2984, 3624, 4776, 5736, 7224, 8504, 9912, 11448, 12960, 14112, 16416, 18336, 20616, 22920, 24496, 26416, 29296, 31704, 35160, 37888, 40576, 43816, 46888, 48936, 51024, 59256},
+ /* NPRB 082*/ { 2280, 2984, 3624, 4776, 5992, 7224, 8504, 9912, 11448, 12960, 14688, 16416, 19080, 21384, 23688, 25456, 26416, 29296, 32856, 35160, 37888, 40576, 43816, 46888, 51024, 52752, 59256},
+ /* NPRB 083*/ { 2280, 2984, 3752, 4776, 5992, 7224, 8760, 10296, 11448, 12960, 14688, 16992, 19080, 21384, 23688, 25456, 27376, 30576, 32856, 35160, 39232, 42368, 45352, 46888, 51024, 52752, 61664},
+ /* NPRB 084*/ { 2344, 3112, 3752, 4968, 5992, 7480, 8760, 10296, 11832, 13536, 14688, 16992, 19080, 21384, 24496, 25456, 27376, 30576, 32856, 36696, 39232, 42368, 45352, 48936, 51024, 52752, 61664},
+ /* NPRB 085*/ { 2344, 3112, 3880, 4968, 5992, 7480, 8760, 10296, 11832, 13536, 14688, 16992, 19080, 22152, 24496, 26416, 27376, 30576, 34008, 36696, 39232, 42368, 45352, 48936, 52752, 55056, 61664},
+ /* NPRB 086*/ { 2408, 3112, 3880, 4968, 6200, 7480, 9144, 10680, 12216, 13536, 15264, 17568, 19848, 22152, 24496, 26416, 28336, 30576, 34008, 36696, 40576, 43816, 46888, 48936, 52752, 55056, 63776},
+ /* NPRB 087*/ { 2408, 3240, 3880, 5160, 6200, 7736, 9144, 10680, 12216, 13536, 15264, 17568, 19848, 22152, 25456, 26416, 28336, 31704, 34008, 37888, 40576, 43816, 46888, 51024, 52752, 55056, 63776},
+ /* NPRB 088*/ { 2472, 3240, 4008, 5160, 6200, 7736, 9144, 10680, 12216, 14112, 15264, 17568, 19848, 22920, 25456, 27376, 28336, 31704, 35160, 37888, 40576, 43816, 46888, 51024, 52752, 55056, 63776},
+ /* NPRB 089*/ { 2472, 3240, 4008, 5160, 6456, 7736, 9144, 11064, 12576, 14112, 15840, 18336, 20616, 22920, 25456, 27376, 29296, 31704, 35160, 37888, 42368, 45352, 48936, 51024, 55056, 57336, 66592},
+ /* NPRB 090*/ { 2536, 3240, 4008, 5352, 6456, 7992, 9528, 11064, 12576, 14112, 15840, 18336, 20616, 22920, 25456, 27376, 29296, 32856, 35160, 39232, 42368, 45352, 48936, 51024, 55056, 57336, 66592},
+ /* NPRB 091*/ { 2536, 3368, 4136, 5352, 6456, 7992, 9528, 11064, 12576, 14112, 15840, 18336, 20616, 23688, 26416, 28336, 29296, 32856, 36696, 39232, 42368, 45352, 48936, 52752, 55056, 57336, 66592},
+ /* NPRB 092*/ { 2536, 3368, 4136, 5352, 6456, 7992, 9528, 11448, 12960, 14688, 16416, 18336, 21384, 23688, 26416, 28336, 30576, 32856, 36696, 39232, 42368, 46888, 48936, 52752, 57336, 59256, 68808},
+ /* NPRB 093*/ { 2600, 3368, 4136, 5352, 6712, 8248, 9528, 11448, 12960, 14688, 16416, 19080, 21384, 23688, 26416, 28336, 30576, 34008, 36696, 40576, 43816, 46888, 51024, 52752, 57336, 59256, 68808},
+ /* NPRB 094*/ { 2600, 3496, 4264, 5544, 6712, 8248, 9912, 11448, 12960, 14688, 16416, 19080, 21384, 24496, 27376, 29296, 30576, 34008, 37888, 40576, 43816, 46888, 51024, 55056, 57336, 59256, 68808},
+ /* NPRB 095*/ { 2664, 3496, 4264, 5544, 6712, 8248, 9912, 11448, 13536, 15264, 16992, 19080, 21384, 24496, 27376, 29296, 30576, 34008, 37888, 40576, 43816, 46888, 51024, 55056, 57336, 61664, 71112},
+ /* NPRB 096*/ { 2664, 3496, 4264, 5544, 6968, 8504, 9912, 11832, 13536, 15264, 16992, 19080, 22152, 24496, 27376, 29296, 31704, 35160, 37888, 40576, 45352, 48936, 51024, 55056, 59256, 61664, 71112},
+ /* NPRB 097*/ { 2728, 3496, 4392, 5736, 6968, 8504, 10296, 11832, 13536, 15264, 16992, 19848, 22152, 25456, 28336, 29296, 31704, 35160, 37888, 42368, 45352, 48936, 52752, 55056, 59256, 61664, 71112},
+ /* NPRB 098*/ { 2728, 3624, 4392, 5736, 6968, 8760, 10296, 11832, 13536, 15264, 16992, 19848, 22152, 25456, 28336, 30576, 31704, 35160, 39232, 42368, 45352, 48936, 52752, 57336, 59256, 61664, 73712},
+ /* NPRB 099*/ { 2728, 3624, 4392, 5736, 6968, 8760, 10296, 12216, 14112, 15840, 17568, 19848, 22920, 25456, 28336, 30576, 31704, 35160, 39232, 42368, 46888, 48936, 52752, 57336, 61664, 63776, 73712},
+ /* NPRB 100*/ { 2792, 3624, 4584, 5736, 7224, 8760, 10296, 12216, 14112, 15840, 17568, 19848, 22920, 25456, 28336, 30576, 32856, 36696, 39232, 43816, 46888, 51024, 55056, 57336, 61664, 63776, 75376},
+ /* NPRB 101*/ { 2792, 3752, 4584, 5992, 7224, 8760, 10680, 12216, 14112, 15840, 17568, 20616, 22920, 26416, 29296, 30576, 32856, 36696, 40576, 43816, 46888, 51024, 55056, 57336, 61664, 63776, 75376},
+ /* NPRB 102*/ { 2856, 3752, 4584, 5992, 7224, 9144, 10680, 12576, 14112, 16416, 18336, 20616, 23688, 26416, 29296, 31704, 32856, 36696, 40576, 43816, 46888, 51024, 55056, 59256, 61664, 63776, 75376},
+ /* NPRB 103*/ { 2856, 3752, 4584, 5992, 7480, 9144, 10680, 12576, 14688, 16416, 18336, 20616, 23688, 26416, 29296, 31704, 34008, 36696, 40576, 43816, 48936, 51024, 55056, 59256, 63776, 66592, 75376},
+ /* NPRB 104*/ { 2856, 3752, 4584, 5992, 7480, 9144, 10680, 12576, 14688, 16416, 18336, 21384, 23688, 26416, 29296, 31704, 34008, 37888, 40576, 45352, 48936, 52752, 57336, 59256, 63776, 66592, 75376},
+ /* NPRB 105*/ { 2984, 3880, 4776, 6200, 7480, 9144, 11064, 12960, 14688, 16416, 18336, 21384, 23688, 27376, 30576, 31704, 34008, 37888, 42368, 45352, 48936, 52752, 57336, 59256, 63776, 66592, 75376},
+ /* NPRB 106*/ { 2984, 3880, 4776, 6200, 7480, 9528, 11064, 12960, 14688, 16992, 18336, 21384, 24496, 27376, 30576, 32856, 34008, 37888, 42368, 45352, 48936, 52752, 57336, 61664, 63776, 66592, 75376},
+ /* NPRB 107*/ { 2984, 3880, 4776, 6200, 7736, 9528, 11064, 12960, 15264, 16992, 19080, 21384, 24496, 27376, 30576, 32856, 35160, 39232, 42368, 46888, 48936, 52752, 57336, 61664, 66592, 68808, 75376},
+ /* NPRB 108*/ { 2984, 4008, 4776, 6200, 7736, 9528, 11448, 12960, 15264, 16992, 19080, 22152, 24496, 27376, 30576, 32856, 35160, 39232, 42368, 46888, 51024, 55056, 59256, 61664, 66592, 68808, 75376},
+ /* NPRB 109*/ { 2984, 4008, 4968, 6456, 7736, 9528, 11448, 13536, 15264, 16992, 19080, 22152, 24496, 28336, 31704, 34008, 35160, 39232, 43816, 46888, 51024, 55056, 59256, 61664, 66592, 68808, 75376},
+ /* NPRB 110*/ { 3112, 4008, 4968, 6456, 7992, 9528, 11448, 13536, 15264, 17568, 19080, 22152, 25456, 28336, 31704, 34008, 35160, 39232, 43816, 46888, 51024, 55056, 59256, 63776, 66592, 71112, 75376}
+
+};
+
+
+
+int
+LteAmc::GetCqiFromSpectralEfficiency (double s)
+{
+ NS_LOG_FUNCTION (s);
+ int cqi = 1; // == CqiIndex[0]
+ while (SpectralEfficiencyForCqiIndex[cqi] < s && cqi <= 14)
+ {
+ cqi++;
+ }
+ NS_LOG_FUNCTION (s << cqi);
+ return cqi;
+}
+
+
+int
+LteAmc::GetMcsFromCqi (int cqi)
+{
+ NS_LOG_FUNCTION (cqi);
+ double spectralEfficiency = SpectralEfficiencyForCqiIndex[cqi - 1];
+ int mcs = 1;
+ while (SpectralEfficiencyForMcsIndex[mcs] < spectralEfficiency && mcs < 28)
+ {
+ mcs++;
+ }
+ NS_LOG_FUNCTION (cqi << mcs);
+ return mcs;
+}
+
+
+int
+LteAmc::GetTbSizeFromMcs (int mcs)
+{
+ NS_LOG_FUNCTION (mcs);
+ NS_LOG_FUNCTION (mcs << TransportBlockSize[mcs]);
+ return TransportBlockSize[mcs];
+}
+
+int
+LteAmc::GetTbSizeFromMcs (int mcs, int nprb)
+{
+ NS_LOG_FUNCTION (mcs);
+ NS_LOG_FUNCTION (mcs << TransportBlockSize[mcs]);
+
+ NS_ASSERT_MSG (mcs < 29, "MCS=" << mcs);
+ NS_ASSERT_MSG (nprb < 111, "NPRB=" << nprb);
+
+ int itbs = McsToItbs[mcs];
+ return (TransportBlockSizeTable[nprb - 1][itbs]);
+}
+
+
+double
+LteAmc::GetSpectralEfficiencyFromCqi (int cqi)
+{
+ NS_LOG_FUNCTION (cqi);
+ NS_LOG_FUNCTION (cqi << SpectralEfficiencyForCqiIndex[cqi - 1]);
+ return SpectralEfficiencyForCqiIndex[cqi - 1];
+}
+
+
+std::vector<int>
+LteAmc::CreateCqiFeedbacks (const SpectrumValue& sinr)
+{
+ NS_LOG_FUNCTION_NOARGS ();
+
+ std::vector<int> cqi;
+ Values::const_iterator it;
+
+ for (it = sinr.ConstValuesBegin (); it != sinr.ConstValuesEnd (); it++)
+ {
+ double sinr_ = (*it);
+
+ /*
+ * Compute the spectral efficiency from the SINR
+ * SINR
+ * spectralEfficiency = log2 (1 + -------------------- )
+ * -ln(5*BER)/1.5
+ * NB: SINR must be expressed in natural unit:
+ * (SINR)dB => 10 ^ (SINR/10)
+ */
+
+ double s = log2 ( 1 + (
+ pow (10, sinr_ / 10 ) /
+ ( (-log (5.0 * 0.00005 )) / 1.5) ));
+
+ int cqi_ = GetCqiFromSpectralEfficiency (s);
+
+ NS_LOG_FUNCTION ("channel_id = " << cqi.size ()
+ << "sinr = " << sinr_
+ << "spectral efficiency =" << s
+ << " ---- CQI = " << cqi_ );
+
+ cqi.push_back (cqi_);
+ }
+
+ return cqi;
+}
+
+} // namespace ns3
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/lte/model/lte-amc.h Thu Mar 10 18:57:41 2011 +0100
@@ -0,0 +1,101 @@
+/* -*- 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
+ *
+ * Original Author: Giuseppe Piro <g.piro@poliba.it>
+ * Modified by: Nicola Baldo <nbaldo@cttc.es>
+ */
+
+#ifndef AMCMODULE_H
+#define AMCMODULE_H
+
+#include <vector>
+#include <ns3/ptr.h>
+
+namespace ns3 {
+
+class SpectrumValue;
+
+/**
+ * \brief The LteAmc class implements the Adaptive Modulation And Coding Scheme
+ * as proposed in 3GPP TSG-RAN WG1 - R1-081483
+ * http://www.3gpp.org/ftp/tsg_ran/WG1_RL1/TSGR1_52b/Docs/R1-081483.zip
+ *
+ * \note All the methods of this class are static, so you'll never
+ * need to create and manage instances of this class.
+ */
+class LteAmc
+{
+
+public:
+ /**
+ * \brief Initialize CQI, MCS, SpectralEfficiency e TBs values
+ */
+ static void Initialize ();
+
+ /**
+ * \brief Get the Modulation anc Coding Scheme for
+ * a CQI value
+ * \param cqi the cqi value
+ * \return the MCS value
+ */
+ static int GetMcsFromCqi (int cqi);
+
+ /**
+ * \brief Get the Transport Block Size for a selected MCS
+ * \param mcs the mcs index
+ * \return the TBs value
+ */
+ static int GetTbSizeFromMcs (int mcs);
+
+ /**
+ * \brief Get the Transport Block Size for a selected MCS and number of PRB (table 7.1.7.2.1-1 of 36.213)
+ * \param mcs the mcs index
+ * \param nprb the no. of PRB
+ * \return the TBs value
+ */
+ static int GetTbSizeFromMcs (int mcs, int nprb);
+
+ /**
+ * \brief Get the spectral efficiency value associated
+ * to the received CQI
+ * \param cqi the cqi value
+ * \return the spectral efficiency value
+ */
+ static double GetSpectralEfficiencyFromCqi (int cqi);
+
+ /**
+ * \brief Create a message with CQI feedback
+ *
+ */
+ static std::vector<int> CreateCqiFeedbacks (const SpectrumValue& sinr);
+
+private:
+ /**
+ * \brief Get a proper CQI for the spectrale efficiency value.
+ * In order to assure a fewer block error rate, the AMC chooses the lower CQI value
+ * for a given spectral efficiency
+ * \param s the spectral efficiency
+ * \return the CQI value
+ */
+ static int GetCqiFromSpectralEfficiency (double s);
+
+};
+
+
+}
+
+#endif /* AMCMODULE_H */
--- a/src/lte/model/lte-enb-mac.cc Thu Mar 10 18:15:26 2011 +0100
+++ b/src/lte/model/lte-enb-mac.cc Thu Mar 10 18:57:41 2011 +0100
@@ -24,14 +24,14 @@
#include <ns3/pointer.h>
#include <ns3/packet.h>
-#include "amc-module.h"
+#include "lte-amc.h"
#include "ideal-control-messages.h"
-#include "enb-net-device.h"
-#include "ue-net-device.h"
+#include "lte-enb-net-device.h"
+#include "lte-ue-net-device.h"
#include <ns3/lte-enb-mac.h>
#include <ns3/lte-mac-tag.h>
-#include <ns3/ue-phy.h>
+#include <ns3/lte-ue-phy.h>
NS_LOG_COMPONENT_DEFINE ("LteEnbMac");
@@ -255,12 +255,12 @@
// ---------- PHY-SAP
-class EnbMemberEnbLtePhySapUser : public LteEnbPhySapUser
+class EnbMemberLteEnbPhySapUser : public LteEnbPhySapUser
{
public:
- EnbMemberEnbLtePhySapUser (LteEnbMac* mac);
+ EnbMemberLteEnbPhySapUser (LteEnbMac* mac);
- // inherited from EnbLtePhySapUser
+ // inherited from LteEnbPhySapUser
virtual void ReceivePhyPdu (Ptr<Packet> p);
virtual void SubframeIndication (uint32_t frameNo, uint32_t subframeNo);
virtual void ReceiveIdealControlMessage (Ptr<IdealControlMessage> msg);
@@ -269,25 +269,25 @@
LteEnbMac* m_mac;
};
-EnbMemberEnbLtePhySapUser::EnbMemberEnbLtePhySapUser (LteEnbMac* mac) : m_mac (mac)
+EnbMemberLteEnbPhySapUser::EnbMemberLteEnbPhySapUser (LteEnbMac* mac) : m_mac (mac)
{
}
void
-EnbMemberEnbLtePhySapUser::ReceivePhyPdu (Ptr<Packet> p)
+EnbMemberLteEnbPhySapUser::ReceivePhyPdu (Ptr<Packet> p)
{
m_mac->DoReceivePhyPdu (p);
}
void
-EnbMemberEnbLtePhySapUser::SubframeIndication (uint32_t frameNo, uint32_t subframeNo)
+EnbMemberLteEnbPhySapUser::SubframeIndication (uint32_t frameNo, uint32_t subframeNo)
{
m_mac->DoSubframeIndication (frameNo, subframeNo);
}
void
-EnbMemberEnbLtePhySapUser::ReceiveIdealControlMessage (Ptr<IdealControlMessage> msg)
+EnbMemberLteEnbPhySapUser::ReceiveIdealControlMessage (Ptr<IdealControlMessage> msg)
{
m_mac->DoReceiveIdealControlMessage (msg);
}
@@ -316,7 +316,7 @@
m_schedSapUser = new EnbMemberFfMacSchedSapUser (this);
m_cschedSapUser = new EnbMemberFfMacCschedSapUser (this);
- m_enbPhySapUser = new EnbMemberEnbLtePhySapUser (this);
+ m_enbPhySapUser = new EnbMemberLteEnbPhySapUser (this);
}
--- a/src/lte/model/lte-enb-mac.h Thu Mar 10 18:15:26 2011 +0100
+++ b/src/lte/model/lte-enb-mac.h Thu Mar 10 18:57:41 2011 +0100
@@ -55,7 +55,7 @@
friend class EnbMemberLteMacSapProvider;
friend class EnbMemberFfMacSchedSapUser;
friend class EnbMemberFfMacCschedSapUser;
- friend class EnbMemberEnbLtePhySapUser;
+ friend class EnbMemberLteEnbPhySapUser;
public:
static TypeId GetTypeId (void);
@@ -165,7 +165,7 @@
void DoSchedUlConfigInd (FfMacSchedSapUser::SchedUlConfigIndParameters params);
/**
- * \brief Forwarded from EnbLtePhySapUser: trigger the start from a new frame
+ * \brief Forwarded from LteEnbPhySapUser: trigger the start from a new frame
*
* \param frameNo frame number
* \param subframeNo subframe number
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/lte/model/lte-enb-net-device.cc Thu Mar 10 18:57:41 2011 +0100
@@ -0,0 +1,217 @@
+/* -*- 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 <mmiozzo@cttc.es> : Update to FF API Architecture
+ * Author: Nicola Baldo <nbaldo@cttc.es> : Integrated with new RRC and MAC architecture
+ */
+
+#include "ns3/llc-snap-header.h"
+#include "ns3/simulator.h"
+#include "ns3/callback.h"
+#include "ns3/node.h"
+#include "ns3/packet.h"
+#include "lte-net-device.h"
+#include "ns3/packet-burst.h"
+#include "ns3/uinteger.h"
+#include "ns3/trace-source-accessor.h"
+#include "ns3/pointer.h"
+#include "ns3/enum.h"
+#include "lte-amc.h"
+#include "lte-enb-mac.h"
+#include "lte-enb-net-device.h"
+#include "lte-enb-rrc.h"
+#include "lte-ue-net-device.h"
+#include "lte-enb-phy.h"
+#include "rr-ff-mac-scheduler.h"
+
+NS_LOG_COMPONENT_DEFINE ("LteEnbNetDevice");
+
+namespace ns3 {
+
+NS_OBJECT_ENSURE_REGISTERED ( LteEnbNetDevice);
+
+uint16_t LteEnbNetDevice::m_cellIdCounter = 0;
+
+TypeId LteEnbNetDevice::GetTypeId (void)
+{
+ static TypeId
+ tid =
+ TypeId ("ns3::LteEnbNetDevice")
+ .SetParent<LteNetDevice> ();
+ return tid;
+}
+
+LteEnbNetDevice::LteEnbNetDevice (void)
+{
+ NS_LOG_FUNCTION (this);
+ NS_FATAL_ERROR ("This constructor should not be called");
+ InitLteEnbNetDevice ();
+}
+
+LteEnbNetDevice::LteEnbNetDevice (Ptr<Node> node, Ptr<LteEnbPhy> phy)
+ : m_phy (phy)
+{
+ NS_LOG_FUNCTION (this);
+ InitLteEnbNetDevice ();
+ SetNode (node);
+}
+
+LteEnbNetDevice::~LteEnbNetDevice (void)
+{
+ NS_LOG_FUNCTION (this);
+}
+
+void
+LteEnbNetDevice::DoDispose ()
+{
+ NS_LOG_FUNCTION (this);
+
+ m_mac->Dispose ();
+ m_mac = 0;
+
+ m_rrc->Dispose ();
+ m_rrc = 0;
+
+ m_phy->Dispose ();
+ m_phy = 0;
+
+ LteNetDevice::DoDispose ();
+}
+
+
+void
+LteEnbNetDevice::InitLteEnbNetDevice (void)
+{
+ NS_LOG_FUNCTION (this);
+
+ m_mac = CreateObject<LteEnbMac> ();
+ // m_mac->SetDevice (this->GetObject<LteNetDevice> ());
+ SetNode (0);
+ if (GetPhy () == 0)
+ {
+ NS_LOG_DEBUG (this << "PHY NULL");
+ }
+ else
+ {
+ NS_LOG_DEBUG (this << "PHY ! NULL");
+ }
+ m_rrc = Create<LteEnbRrc> ();
+ m_rrc->SetLteEnbCmacSapProvider (m_mac->GetLteEnbCmacSapProvider ());
+ m_mac->SetLteEnbCmacSapUser (m_rrc->GetLteEnbCmacSapUser ());
+ m_rrc->SetLteMacSapProvider (m_mac->GetLteMacSapProvider ());
+
+ m_scheduler = Create<RrFfMacScheduler> ();
+ m_mac->SetFfMacSchedSapProvider (m_scheduler->GetFfMacSchedSapProvider ());
+ m_mac->SetFfMacCschedSapProvider (m_scheduler->GetFfMacCschedSapProvider ());
+
+ m_scheduler->SetFfMacSchedSapUser (m_mac->GetFfMacSchedSapUser ());
+ m_scheduler->SetFfMacCschedSapUser (m_mac->GetFfMacCschedSapUser ());
+
+ GetPhy ()->GetObject<LteEnbPhy> ()->SetLteEnbPhySapUser (m_mac->GetLteEnbPhySapUser ());
+ m_mac->SetLteEnbPhySapProvider (GetPhy ()->GetObject<LteEnbPhy> ()->GetLteEnbPhySapProvider ());
+
+ m_rrc->ConfigureCell (25, 25);
+ NS_ASSERT_MSG (m_cellIdCounter < 65535, "max num eNBs exceeded");
+ m_cellId = ++m_cellIdCounter;
+
+ // WILD HACK - should use the PHY SAP instead. Probably should handle this through the RRC
+ GetPhy ()->GetObject<LteEnbPhy> ()->DoSetBandwidth (25,25);
+ GetPhy ()->GetObject<LteEnbPhy> ()->DoSetCellId (m_cellId);
+
+ Simulator::ScheduleNow (&LteEnbPhy::StartFrame, GetPhy ()->GetObject<LteEnbPhy> ());
+}
+
+
+Ptr<LteEnbMac>
+LteEnbNetDevice::GetMac (void)
+{
+ NS_LOG_FUNCTION (this);
+ return m_mac;
+}
+
+
+Ptr<LteEnbPhy>
+LteEnbNetDevice::GetPhy (void) const
+{
+ NS_LOG_FUNCTION (this);
+ return m_phy;
+}
+
+
+bool
+LteEnbNetDevice::DoSend (Ptr<Packet> packet, const Mac48Address& source,
+ const Mac48Address& dest, uint16_t protocolNumber)
+{
+ NS_LOG_FUNCTION (this << source << dest << protocolNumber);
+
+ NS_FATAL_ERROR ("IP connectivity not implemented yet");
+
+ /*
+ * The classification of traffic in DL is done by the PGW (not
+ * by the eNB).
+ * Hovever, the core network is not implemented yet.
+ * For now the classification is managed by the eNB.
+ */
+
+ // if (protocolNumber == 2048)
+ // {
+ // // it is an IP packet
+ // }
+
+ // if (protocolNumber != 2048 || bearer == 0)
+ // {
+
+ // }
+
+
+ return true;
+}
+
+
+void
+LteEnbNetDevice::DoReceive (Ptr<Packet> p)
+{
+ NS_LOG_FUNCTION (this << p);
+ ForwardUp (p->Copy ());
+}
+
+
+void
+LteEnbNetDevice::SendIdealPdcchMessage (void)
+{
+ NS_LOG_FUNCTION (this);
+ /*
+ * Get both PDCCH ideal message for UL and DL and
+ * set assigned resources to UEs using
+ * SendAssignedDLResources and SendAssignedULResources
+ */
+}
+
+Ptr<LteEnbRrc>
+LteEnbNetDevice::GetRrc ()
+{
+ return m_rrc;
+}
+
+uint16_t
+LteEnbNetDevice::GetCellId ()
+{
+ return m_cellId;
+}
+
+} // namespace ns3
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/lte/model/lte-enb-net-device.h Thu Mar 10 18:57:41 2011 +0100
@@ -0,0 +1,122 @@
+/* -*- 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> : Update to FF API Architecture
+ */
+
+#ifndef LTE_ENB_NET_DEVICE_H
+#define LTE_ENB_NET_DEVICE_H
+
+#include "lte-net-device.h"
+#include "ns3/event-id.h"
+#include "ns3/mac48-address.h"
+#include "ns3/traced-callback.h"
+#include "ns3/nstime.h"
+#include "ns3/log.h"
+#include "lte-phy.h"
+#include <vector>
+
+namespace ns3 {
+
+class Packet;
+class PacketBurst;
+class Node;
+class LtePhy;
+class LteEnbPhy;
+class LteEnbMac;
+class LteEnbRrc;
+class RrFfMacScheduler;
+
+
+/**
+ * The eNodeB device implementation
+ */
+class LteEnbNetDevice : public LteNetDevice
+{
+public:
+ static TypeId GetTypeId (void);
+
+ LteEnbNetDevice (void);
+ /**
+ * \brief Create eNB net device
+ * \param node the network node
+ * \param phy the physical object attache dto it
+ */
+ LteEnbNetDevice (Ptr<Node> node, Ptr<LteEnbPhy> phy);
+
+ virtual ~LteEnbNetDevice (void);
+ virtual void DoDispose (void);
+
+ /**
+ * \brief Initialize all parameters of this device
+ */
+ void InitLteEnbNetDevice (void);
+
+ /**
+ * \return a pointer to the MAC
+ */
+ Ptr<LteEnbMac> GetMac (void);
+
+ /**
+ * \return a pointer to the physical layer.
+ */
+ Ptr<LteEnbPhy> GetPhy (void) const;
+
+
+
+ Ptr<LteEnbRrc> GetRrc ();
+
+ /**
+ * \brief Send the PDCCH ideal mesages under an
+ * ideal control channel
+ */
+ void SendIdealPdcchMessage (void);
+
+
+ /**
+ *
+ * \return the Cell Identifier of this eNB
+ */
+ uint16_t GetCellId ();
+
+private:
+ bool DoSend (Ptr<Packet> packet,
+ const Mac48Address& source,
+ const Mac48Address& dest,
+ uint16_t protocolNumber);
+
+ void DoReceive (Ptr<Packet> p);
+
+ // Ptr<UeManager> m_ueManager;
+
+ Ptr<LteEnbMac> m_mac;
+
+ Ptr<LteEnbPhy> m_phy;
+
+ Ptr<LteEnbRrc> m_rrc;
+
+ Ptr<RrFfMacScheduler> m_scheduler;
+
+ uint16_t m_cellId; /**< Cell Identifer. Part of the CGI, see TS 29.274, section 8.21.1 */
+
+ static uint16_t m_cellIdCounter;
+};
+
+} // namespace ns3
+
+#endif /* LTE_ENB_NET_DEVICE_H */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/lte/model/lte-enb-phy.cc Thu Mar 10 18:57:41 2011 +0100
@@ -0,0 +1,375 @@
+/* -*- 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 <mmiozzo@cttc.es>
+ */
+
+#include <ns3/object-factory.h>
+#include <ns3/log.h>
+#include <math.h>
+#include <ns3/simulator.h>
+#include "ns3/spectrum-error-model.h"
+#include "lte-enb-phy.h"
+#include "lte-net-device.h"
+#include "lte-spectrum-value-helper.h"
+#include "ideal-control-messages.h"
+#include "lte-enb-net-device.h"
+#include "lte-enb-mac.h"
+
+
+NS_LOG_COMPONENT_DEFINE ("LteEnbPhy");
+
+namespace ns3 {
+
+
+////////////////////////////////////////
+// member SAP forwarders
+////////////////////////////////////////
+
+
+class EnbMemberLteEnbPhySapProvider : public LteEnbPhySapProvider
+{
+public:
+ EnbMemberLteEnbPhySapProvider (LteEnbPhy* phy);
+
+ // inherited from LteEnbPhySapProvider
+ 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);
+
+private:
+ LteEnbPhy* m_phy;
+};
+
+EnbMemberLteEnbPhySapProvider::EnbMemberLteEnbPhySapProvider (LteEnbPhy* phy) : m_phy (phy)
+{
+
+}
+
+
+void
+EnbMemberLteEnbPhySapProvider::SendMacPdu (Ptr<Packet> p)
+{
+ m_phy->DoSendMacPdu (p);
+}
+
+void
+EnbMemberLteEnbPhySapProvider::SetBandwidth (uint8_t ulBandwidth, uint8_t dlBandwidth)
+{
+ m_phy->DoSetBandwidth (ulBandwidth, dlBandwidth);
+}
+
+void
+EnbMemberLteEnbPhySapProvider::SetCellId (uint16_t cellId)
+{
+ m_phy->DoSetCellId (cellId);
+}
+
+void
+EnbMemberLteEnbPhySapProvider::SendIdealControlMessage (Ptr<IdealControlMessage> msg)
+{
+ m_phy->DoSendIdealControlMessage (msg);
+}
+
+
+////////////////////////////////////////
+// generic LteEnbPhy methods
+////////////////////////////////////////
+
+
+
+NS_OBJECT_ENSURE_REGISTERED (LteEnbPhy);
+
+
+LteEnbPhy::LteEnbPhy ()
+ : m_nrFrames (0),
+ m_nrSubFrames (0)
+{
+ m_enbPhySapProvider = new EnbMemberLteEnbPhySapProvider (this);
+}
+
+
+TypeId
+LteEnbPhy::GetTypeId (void)
+{
+ static TypeId tid = TypeId ("ns3::LteEnbPhy")
+ .SetParent<LtePhy> ()
+ .AddConstructor<LteEnbPhy> ()
+ ;
+ return tid;
+}
+
+
+LteEnbPhy::~LteEnbPhy ()
+{
+}
+
+void
+LteEnbPhy::SetLteEnbPhySapUser (LteEnbPhySapUser* s)
+{
+ m_enbPhySapUser = s;
+}
+
+LteEnbPhySapProvider*
+LteEnbPhy::GetLteEnbPhySapProvider ()
+{
+ return (m_enbPhySapProvider);
+}
+
+
+
+bool
+LteEnbPhy::AddUePhy (uint8_t rnti, Ptr<LteUePhy> phy)
+{
+ std::map <uint8_t, Ptr<LteUePhy> >::iterator it;
+ it = m_ueAttached.find (rnti);
+ if (it == m_ueAttached.end ())
+ {
+ m_ueAttached.insert (std::pair<uint8_t, Ptr<LteUePhy> > (rnti, phy));
+ return (true);
+ }
+ else
+ {
+ NS_LOG_ERROR ("UE already attached");
+ return (false);
+ }
+}
+
+bool
+LteEnbPhy::DeleteUePhy (uint8_t rnti)
+{
+ std::map <uint8_t, Ptr<LteUePhy> >::iterator it;
+ it = m_ueAttached.find (rnti);
+ if (it == m_ueAttached.end ())
+ {
+ NS_LOG_ERROR ("UE not attached");
+ return (false);
+ }
+ else
+ {
+ m_ueAttached.erase (it);
+ return (true);
+ }
+}
+
+
+
+void
+LteEnbPhy::DoSendMacPdu (Ptr<Packet> p)
+{
+// NS_LOG_FUNCTION (this << pb->GetNPackets () << pb->GetSize ());
+// return GetDownlinkSpectrumPhy ()->StartTx (pb);
+
+ NS_LOG_FUNCTION (this);
+ SetMacPdu (p);
+}
+
+
+void
+LteEnbPhy::PhyPduReceived (Ptr<Packet> p)
+{
+ NS_LOG_FUNCTION (this);
+ m_enbPhySapUser->ReceivePhyPdu (p);
+}
+
+void
+LteEnbPhy::DoSetDownlinkSubChannels ()
+{
+ NS_LOG_FUNCTION (this);
+ Ptr<SpectrumValue> txPsd = CreateTxPowerSpectralDensity ();
+ GetDownlinkSpectrumPhy ()->SetTxPowerSpectralDensity (txPsd);
+}
+
+
+Ptr<SpectrumValue>
+LteEnbPhy::CreateTxPowerSpectralDensity ()
+{
+ NS_LOG_FUNCTION (this);
+
+ LteSpectrumValueHelper psdHelper;
+ Ptr<SpectrumValue> psd = psdHelper.CreateDownlinkTxPowerSpectralDensity (GetTxPower (), GetDownlinkSubChannels ());
+
+ return psd;
+}
+
+
+void
+LteEnbPhy::CalcChannelQualityForUe (std::vector <double> sinr, Ptr<LteSpectrumPhy> ue)
+{
+ NS_LOG_FUNCTION (this);
+}
+
+
+void
+LteEnbPhy::DoSendIdealControlMessage (Ptr<IdealControlMessage> msg)
+{
+ NS_LOG_FUNCTION (this << msg);
+ // queues the message (wait for MAC-PHY delay)
+ SetControlMessages (msg);
+}
+
+
+
+void
+LteEnbPhy::ReceiveIdealControlMessage (Ptr<IdealControlMessage> msg)
+{
+ NS_LOG_FUNCTION (this << msg);
+ m_enbPhySapUser->ReceiveIdealControlMessage (msg);
+}
+
+
+
+void
+LteEnbPhy::StartFrame (void)
+{
+ NS_LOG_FUNCTION (this);
+
+ ++m_nrFrames;
+ NS_LOG_INFO ("-----frame " << m_nrFrames << "-----");
+ m_nrSubFrames = 0;
+ StartSubFrame ();
+}
+
+
+void
+LteEnbPhy::StartSubFrame (void)
+{
+ NS_LOG_FUNCTION (this);
+
+ ++m_nrSubFrames;
+ NS_LOG_INFO ("-----sub frame " << m_nrSubFrames << "-----");
+
+ // send the current burst of control messages
+ std::list<Ptr<IdealControlMessage> > ctrlMsg = GetControlMessages ();
+ std::vector <int> dlRb;
+ if (ctrlMsg.size () > 0)
+ {
+ std::list<Ptr<IdealControlMessage> >::iterator it;
+ it = ctrlMsg.begin ();
+ while (it != ctrlMsg.end ())
+ {
+ Ptr<IdealControlMessage> msg = (*it);
+ if (msg->GetMessageType () == IdealControlMessage::DL_DCI)
+ {
+ std::map <uint8_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
+ {
+ // get the tx power spectral density according to DL-DCI(s)
+ // translate the DCI to Spectrum framework
+ uint32_t mask = 0x1;
+ for (int i = 0; i < 32; i++)
+ {
+ if (((dci->GetDci ().m_rbBitmap & mask) >> i) == 1)
+ {
+ for (int k = 0; k < GetRbgSize (); k++)
+ {
+ dlRb.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)
+ {
+ std::map <uint8_t, Ptr<LteUePhy> >::iterator it2;
+ Ptr<UlDciIdealControlMessage> dci = DynamicCast<UlDciIdealControlMessage> (msg);
+ it2 = m_ueAttached.find (dci->GetDci ().m_rnti);
+
+ if (it2 == m_ueAttached.end ())
+ {
+ NS_LOG_ERROR ("UE not attached");
+ }
+ else
+ {
+ (*it2).second->ReceiveIdealControlMessage (msg);
+ }
+ }
+ ctrlMsg.pop_front ();
+ it = ctrlMsg.begin ();
+ }
+ }
+ // set the current tx power spectral density
+ SetDownlinkSubChannels (dlRb);
+ // send the current burts of packets
+ Ptr<PacketBurst> pb = GetPacketBurst ();
+ if (pb)
+ {
+ GetDownlinkSpectrumPhy ()->StartTx (pb);
+ }
+
+ // trigger the MAC
+ Ptr<LteEnbMac> macEntity = GetDevice ()->GetObject<LteEnbNetDevice> ()->GetMac ();
+
+ m_enbPhySapUser->SubframeIndication (m_nrFrames, m_nrSubFrames);
+
+
+ // trigger the UE(s)
+ std::map <uint8_t, Ptr<LteUePhy> >::iterator it;
+ for (it = m_ueAttached.begin (); it != m_ueAttached.end (); it++)
+ {
+ (*it).second->SubframeIndication (m_nrFrames, m_nrSubFrames);
+ }
+
+ Simulator::Schedule (Seconds (GetTti ()),
+ &LteEnbPhy::EndSubFrame,
+ this);
+
+}
+
+
+void
+LteEnbPhy::EndSubFrame (void)
+{
+ NS_LOG_FUNCTION (this << Simulator::Now ().GetSeconds ());
+ if (m_nrSubFrames == 10)
+ {
+ Simulator::ScheduleNow (&LteEnbPhy::EndFrame, this);
+ }
+ else
+ {
+ Simulator::ScheduleNow (&LteEnbPhy::StartSubFrame, this);
+ }
+}
+
+
+void
+LteEnbPhy::EndFrame (void)
+{
+ NS_LOG_FUNCTION (this << Simulator::Now ().GetSeconds ());
+ Simulator::ScheduleNow (&LteEnbPhy::StartFrame, this);
+}
+
+
+void
+LteEnbPhy::GenerateCqiFeedback (const SpectrumValue& sinr)
+{
+ NS_LOG_FUNCTION (this << sinr);
+}
+
+};
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/lte/model/lte-enb-phy.h Thu Mar 10 18:57:41 2011 +0100
@@ -0,0 +1,149 @@
+/* -*- 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 ENB_LTE_PHY_H
+#define ENB_LTE_PHY_H
+
+
+#include "lte-phy.h"
+#include <ns3/lte-enb-phy-sap.h>
+#include <map>
+#include <ns3/lte-ue-phy.h>
+
+namespace ns3 {
+
+class PacketBurst;
+class LteNetDevice;
+
+/**
+ * LteEnbPhy models the physical layer for the eNodeB
+ */
+class LteEnbPhy : public LtePhy
+{
+
+ friend class EnbMemberLteEnbPhySapProvider;
+
+public:
+ LteEnbPhy ();
+
+ /**
+ * \brief Create the eNB phy layer
+ * \param d the device where the phy layer is attached
+ */
+ LteEnbPhy (Ptr<LteNetDevice> d);
+ virtual ~LteEnbPhy ();
+
+ static TypeId GetTypeId (void);
+
+
+ /**
+ * \brief Get the PHY SAP provider
+ * \return a pointer to the SAP Provider of the PHY
+ */
+ LteEnbPhySapProvider* GetLteEnbPhySapProvider ();
+
+ /**
+ * \brief Set the PHY SAP User
+ * \param s a pointer to the PHY SAP user
+ */
+ void SetLteEnbPhySapUser (LteEnbPhySapUser* s);
+
+
+ /**
+ * \brief Queue the MAC PDU to be sent
+ * \param p the MAC PDU to sent
+ */
+ virtual void DoSendMacPdu (Ptr<Packet> p);
+
+
+ void DoSetDownlinkSubChannels ();
+
+ /**
+ * \brief Create the PSD for TX
+ */
+ virtual Ptr<SpectrumValue> CreateTxPowerSpectralDensity ();
+
+ /**
+ * \brief Calculate the channel quality for a given UE
+ * \param sinr a list of computed SINR
+ * \param ue the UE
+ */
+ 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);
+
+
+ void DoSendIdealControlMessage (Ptr<IdealControlMessage> msg);
+
+ bool AddUePhy (uint8_t rnti, Ptr<LteUePhy> phy);
+
+ bool DeleteUePhy (uint8_t rnti);
+
+
+ /**
+ * \brief Start a LTE frame
+ */
+ void StartFrame (void);
+ /**
+ * \brief Start a LTE sub frame
+ */
+ void StartSubFrame (void);
+ /**
+ * \brief End a LTE sub frame
+ */
+ void EndSubFrame (void);
+ /**
+ * \brief End a LTE frame
+ */
+ void EndFrame (void);
+
+ /**
+ * \brief PhySpectrum received a new PHY-PDU
+ */
+ void PhyPduReceived (Ptr<Packet> p);
+
+ // inherited from LtePhy
+ virtual void GenerateCqiFeedback (const SpectrumValue& sinr);
+
+
+private:
+ std::map <uint8_t, Ptr<LteUePhy> > m_ueAttached;
+
+ LteEnbPhySapProvider* m_enbPhySapProvider;
+ LteEnbPhySapUser* m_enbPhySapUser;
+
+ uint32_t m_nrFrames;
+ uint32_t m_nrSubFrames;
+};
+
+
+}
+
+#endif /* LTE_ENB_PHY_H */
--- a/src/lte/model/lte-net-device.cc Thu Mar 10 18:15:26 2011 +0100
+++ b/src/lte/model/lte-net-device.cc Thu Mar 10 18:57:41 2011 +0100
@@ -30,7 +30,7 @@
#include "ns3/trace-source-accessor.h"
#include "ns3/pointer.h"
#include "ns3/enum.h"
-#include "amc-module.h"
+#include "lte-amc.h"
#include "ns3/ipv4-header.h"
#include <ns3/lte-mac-tag.h>
--- a/src/lte/model/lte-ue-mac.cc Thu Mar 10 18:15:26 2011 +0100
+++ b/src/lte/model/lte-ue-mac.cc Thu Mar 10 18:57:41 2011 +0100
@@ -27,7 +27,7 @@
#include <ns3/packet-burst.h>
#include "lte-ue-mac.h"
-#include "ue-net-device.h"
+#include "lte-ue-net-device.h"
#include "lte-mac-tag.h"
#include <ns3/ff-mac-common.h>
#include <ns3/ideal-control-messages.h>
@@ -132,10 +132,10 @@
-class UeMemberUeLtePhySapUser : public LteUePhySapUser
+class UeMemberLteUePhySapUser : public LteUePhySapUser
{
public:
- UeMemberUeLtePhySapUser (LteUeMac* mac);
+ UeMemberLteUePhySapUser (LteUeMac* mac);
// inherited from LtePhySapUser
virtual void ReceivePhyPdu (Ptr<Packet> p);
@@ -146,26 +146,26 @@
LteUeMac* m_mac;
};
-UeMemberUeLtePhySapUser::UeMemberUeLtePhySapUser (LteUeMac* mac) : m_mac (mac)
+UeMemberLteUePhySapUser::UeMemberLteUePhySapUser (LteUeMac* mac) : m_mac (mac)
{
}
void
-UeMemberUeLtePhySapUser::ReceivePhyPdu (Ptr<Packet> p)
+UeMemberLteUePhySapUser::ReceivePhyPdu (Ptr<Packet> p)
{
m_mac->DoReceivePhyPdu (p);
}
void
-UeMemberUeLtePhySapUser::SubframeIndication (uint32_t frameNo, uint32_t subframeNo)
+UeMemberLteUePhySapUser::SubframeIndication (uint32_t frameNo, uint32_t subframeNo)
{
NS_LOG_LOGIC (this << " UE-MAC does not yet support this primitive");
}
void
-UeMemberUeLtePhySapUser::ReceiveIdealControlMessage (Ptr<IdealControlMessage> msg)
+UeMemberLteUePhySapUser::ReceiveIdealControlMessage (Ptr<IdealControlMessage> msg)
{
m_mac->DoReceiveIdealControlMessage (msg);
}
@@ -192,7 +192,7 @@
{
m_macSapProvider = new UeMemberLteMacSapProvider (this);
m_cmacSapProvider = new UeMemberLteUeCmacSapProvider (this);
- m_uePhySapUser = new UeMemberUeLtePhySapUser (this);
+ m_uePhySapUser = new UeMemberLteUePhySapUser (this);
}
--- a/src/lte/model/lte-ue-mac.h Thu Mar 10 18:15:26 2011 +0100
+++ b/src/lte/model/lte-ue-mac.h Thu Mar 10 18:57:41 2011 +0100
@@ -38,7 +38,7 @@
{
friend class UeMemberLteUeCmacSapProvider;
friend class UeMemberLteMacSapProvider;
- friend class UeMemberUeLtePhySapUser;
+ friend class UeMemberLteUePhySapUser;
public:
static TypeId GetTypeId (void);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/lte/model/lte-ue-net-device.cc Thu Mar 10 18:57:41 2011 +0100
@@ -0,0 +1,187 @@
+/* -*- 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>
+ * Nicola Baldo <nbaldo@cttc.es>
+ * Marco Miozzo <mmiozzo@cttc.es>
+ */
+
+#include "ns3/llc-snap-header.h"
+#include "ns3/simulator.h"
+#include "ns3/callback.h"
+#include "ns3/node.h"
+#include "ns3/packet.h"
+#include "lte-net-device.h"
+#include "ns3/packet-burst.h"
+#include "ns3/uinteger.h"
+#include "ns3/trace-source-accessor.h"
+#include "ns3/pointer.h"
+#include "ns3/enum.h"
+#include "lte-enb-net-device.h"
+#include "lte-ue-net-device.h"
+#include "lte-ue-mac.h"
+#include "lte-ue-rrc.h"
+#include "ns3/ipv4-header.h"
+#include "ns3/ipv4.h"
+#include "lte-amc.h"
+// #include "ideal-control-messages.h"
+#include <ns3/lte-ue-phy.h>
+
+NS_LOG_COMPONENT_DEFINE ("LteUeNetDevice");
+
+namespace ns3 {
+
+NS_OBJECT_ENSURE_REGISTERED ( LteUeNetDevice);
+
+
+TypeId LteUeNetDevice::GetTypeId (void)
+{
+ static TypeId
+ tid =
+ TypeId ("ns3::LteUeNetDevice")
+ .SetParent<LteNetDevice> ();
+ return tid;
+}
+
+
+LteUeNetDevice::LteUeNetDevice (void)
+{
+ NS_LOG_FUNCTION (this);
+ NS_FATAL_ERROR ("This constructor should not be called");
+ InitLteUeNetDevice ();
+}
+
+
+LteUeNetDevice::LteUeNetDevice (Ptr<Node> node, Ptr<LteUePhy> phy)
+ : m_phy (phy)
+{
+ NS_LOG_FUNCTION (this);
+ InitLteUeNetDevice ();
+ SetNode (node);
+
+ /**
+ * WILD HACK
+ * to be translated to PHY-SAP primitive
+ */
+ phy->DoSetBandwidth (25,25);
+}
+
+LteUeNetDevice::~LteUeNetDevice (void)
+{
+ NS_LOG_FUNCTION (this);
+}
+
+void
+LteUeNetDevice::DoDispose (void)
+{
+ NS_LOG_FUNCTION (this);
+ m_targetEnb = 0;
+ m_mac->Dispose ();
+ m_mac = 0;
+ m_rrc->Dispose ();
+ m_rrc = 0;
+ m_phy->Dispose ();
+ m_phy = 0;
+ LteNetDevice::DoDispose ();
+}
+
+void
+LteUeNetDevice::InitLteUeNetDevice (void)
+{
+ NS_LOG_FUNCTION (this);
+ m_targetEnb = 0;
+ SetNode (0);
+ m_mac = CreateObject<LteUeMac> ();
+ m_rrc = Create<LteUeRrc> ();
+ m_rrc->SetLteUeCmacSapProvider (m_mac->GetLteUeCmacSapProvider ());
+ m_mac->SetLteUeCmacSapUser (m_rrc->GetLteUeCmacSapUser ());
+ m_rrc->SetLteMacSapProvider (m_mac->GetLteMacSapProvider ());
+ m_phy->SetLteUePhySapUser (m_mac->GetLteUePhySapUser ());
+ m_mac->SetLteUePhySapProvider (m_phy->GetLteUePhySapProvider ());
+}
+
+
+
+Ptr<LteUeMac>
+LteUeNetDevice::GetMac (void)
+{
+ NS_LOG_FUNCTION (this);
+ return m_mac;
+}
+
+
+Ptr<LteUeRrc>
+LteUeNetDevice::GetRrc (void)
+{
+ NS_LOG_FUNCTION (this);
+ return m_rrc;
+}
+
+
+Ptr<LteUePhy>
+LteUeNetDevice::GetPhy (void) const
+{
+ NS_LOG_FUNCTION (this);
+ return m_phy;
+}
+
+void
+LteUeNetDevice::SetTargetEnb (Ptr<LteEnbNetDevice> enb)
+{
+ NS_LOG_FUNCTION (this << enb);
+ m_targetEnb = enb;
+}
+
+
+Ptr<LteEnbNetDevice>
+LteUeNetDevice::GetTargetEnb (void)
+{
+ NS_LOG_FUNCTION (this);
+ return m_targetEnb;
+}
+
+
+bool
+LteUeNetDevice::DoSend (Ptr<Packet> packet, const Mac48Address& source,
+ const Mac48Address& dest, uint16_t protocolNumber)
+{
+ NS_LOG_FUNCTION (this);
+
+ NS_FATAL_ERROR ("IP connectivity not implemented yet");
+
+ return (true);
+}
+
+
+void
+LteUeNetDevice::DoReceive (Ptr<Packet> p)
+{
+ NS_LOG_FUNCTION (this << p);
+
+ NS_FATAL_ERROR ("IP connectivity not implemented yet");
+
+ Ptr<Packet> packet = p->Copy ();
+
+ LlcSnapHeader llcHdr;
+ packet->RemoveHeader (llcHdr);
+ NS_LOG_FUNCTION (this << llcHdr);
+
+ ForwardUp (packet);
+}
+
+
+} // namespace ns3
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/lte/model/lte-ue-net-device.h Thu Mar 10 18:57:41 2011 +0100
@@ -0,0 +1,107 @@
+/* -*- 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>
+ * Nicola Baldo <nbaldo@cttc.es>
+ */
+
+#ifndef LTE_UE_NET_DEVICE_H
+#define LTE_UE_NET_DEVICE_H
+
+#include "lte-net-device.h"
+#include "ns3/event-id.h"
+#include "ns3/mac48-address.h"
+#include "ns3/traced-callback.h"
+#include "ns3/nstime.h"
+#include "ns3/log.h"
+#include "lte-phy.h"
+#include "lte-phy.h"
+
+
+namespace ns3 {
+
+class Packet;
+class PacketBurst;
+class Node;
+class LtePhy;
+class LteUePhy;
+class LteEnbNetDevice;
+class LteUeMac;
+class LteUeRrc;
+
+/**
+ * The LteUeNetDevice class implements the UE net device
+ */
+class LteUeNetDevice : public LteNetDevice
+{
+public:
+ static TypeId GetTypeId (void);
+
+ LteUeNetDevice (void);
+ /**
+ * \brief Create an UE net device
+ * \param node
+ * \param phy
+ */
+ LteUeNetDevice (Ptr<Node> node, Ptr<LteUePhy> phy);
+
+ virtual ~LteUeNetDevice (void);
+ virtual void DoDispose ();
+
+
+ Ptr<LteUeMac> GetMac (void);
+
+ Ptr<LteUeRrc> GetRrc ();
+
+ Ptr<LteUePhy> GetPhy (void) const;
+
+ /**
+ * \brief Initialize the UE
+ */
+
+ void InitLteUeNetDevice (void);
+
+ /**
+ * \brief Set the targer eNB where the UE is registered
+ * \param enb
+ */
+ void SetTargetEnb (Ptr<LteEnbNetDevice> enb);
+ /**
+ * \brief Get the targer eNB where the UE is registered
+ * \return the pointer to the enb
+ */
+ Ptr<LteEnbNetDevice> GetTargetEnb (void);
+
+
+private:
+ bool DoSend (Ptr<Packet> packet,
+ const Mac48Address& source,
+ const Mac48Address& dest,
+ uint16_t protocolNumber);
+
+ void DoReceive (Ptr<Packet> p);
+
+ Ptr<LteEnbNetDevice> m_targetEnb;
+
+ Ptr<LteUeMac> m_mac;
+ Ptr<LteUePhy> m_phy;
+ Ptr<LteUeRrc> m_rrc;
+};
+
+} // namespace ns3
+
+#endif /* LTE_UE_NET_DEVICE_H */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/lte/model/lte-ue-phy.cc Thu Mar 10 18:57:41 2011 +0100
@@ -0,0 +1,384 @@
+/* -*- 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>
+ * Nicola Baldo <nbaldo@cttc.es>
+ */
+
+#include <ns3/object-factory.h>
+#include <ns3/log.h>
+#include <math.h>
+#include <ns3/simulator.h>
+#include <ns3/spectrum-error-model.h>
+#include "lte-ue-phy.h"
+#include "lte-enb-phy.h"
+#include "lte-net-device.h"
+#include "lte-ue-net-device.h"
+#include "lte-enb-net-device.h"
+#include "lte-spectrum-value-helper.h"
+#include "lte-amc.h"
+#include "lte-ue-mac.h"
+#include "ff-mac-common.h"
+#include "lte-sinr-chunk-processor.h"
+
+
+NS_LOG_COMPONENT_DEFINE ("LteUePhy");
+
+namespace ns3 {
+
+////////////////////////////////////////
+// member SAP forwarders
+////////////////////////////////////////
+
+
+class UeMemberLteUePhySapProvider : public LteUePhySapProvider
+{
+public:
+ UeMemberLteUePhySapProvider (LteUePhy* phy);
+
+ // inherited from LtePhySapProvider
+ virtual void SendMacPdu (Ptr<Packet> p);
+ virtual void SetBandwidth (uint8_t ulBandwidth, uint8_t dlBandwidth);
+ virtual void SendIdealControlMessage (Ptr<IdealControlMessage> msg);
+
+private:
+ LteUePhy* m_phy;
+};
+
+UeMemberLteUePhySapProvider::UeMemberLteUePhySapProvider (LteUePhy* phy) : m_phy (phy)
+{
+
+}
+
+
+void
+UeMemberLteUePhySapProvider::SendMacPdu (Ptr<Packet> p)
+{
+ m_phy->DoSendMacPdu (p);
+}
+
+void
+UeMemberLteUePhySapProvider::SetBandwidth (uint8_t ulBandwidth, uint8_t dlBandwidth)
+{
+ m_phy->DoSetBandwidth (ulBandwidth, dlBandwidth);
+}
+
+void
+UeMemberLteUePhySapProvider::SendIdealControlMessage (Ptr<IdealControlMessage> msg)
+{
+ m_phy->DoSendIdealControlMessage (msg);
+}
+
+
+
+////////////////////////////////////////
+// generic LteUePhy methods
+////////////////////////////////////////
+
+
+NS_OBJECT_ENSURE_REGISTERED (LteUePhy);
+
+
+LteUePhy::LteUePhy ()
+ : m_p10CqiPeriocity (MilliSeconds (2)),
+ m_p10CqiLast (MilliSeconds (0))
+{
+ m_uePhySapProvider = new UeMemberLteUePhySapProvider (this);
+}
+
+
+LteUePhy::~LteUePhy ()
+{
+}
+
+void
+LteUePhy::DoDispose ()
+{
+}
+
+
+
+TypeId
+LteUePhy::GetTypeId (void)
+{
+ static TypeId tid = TypeId ("ns3::LteUePhy")
+ .SetParent<LtePhy> ()
+ .AddConstructor<LteUePhy> ()
+ ;
+ return tid;
+}
+
+
+void
+LteUePhy::SetLteUePhySapUser (LteUePhySapUser* s)
+{
+ m_uePhySapUser = s;
+}
+
+LteUePhySapProvider*
+LteUePhy::GetLteUePhySapProvider ()
+{
+ return (m_uePhySapProvider);
+}
+
+
+void
+LteUePhy::DoSendMacPdu (Ptr<Packet> p)
+{
+ NS_LOG_FUNCTION (this);
+
+ SetMacPdu (p);
+}
+
+
+void
+LteUePhy::PhyPduReceived (Ptr<Packet> p)
+{
+ m_uePhySapUser->ReceivePhyPdu (p);
+}
+
+void
+LteUePhy::DoSetUplinkSubChannels ()
+{
+ NS_LOG_FUNCTION (this);
+
+ /*
+ * XXX: the uplink scheduler is not implemented yet!
+ * Now, all uplink sub channels can be used for uplink transmission
+ */
+ SetSubChannelsForTransmission (GetUplinkSubChannels ());
+}
+
+
+void
+LteUePhy::SetSubChannelsForTransmission (std::vector <int> mask)
+{
+ NS_LOG_FUNCTION (this);
+
+ m_subChannelsForTransmission = mask;
+
+ Ptr<SpectrumValue> txPsd = CreateTxPowerSpectralDensity ();
+ GetUplinkSpectrumPhy ()->SetTxPowerSpectralDensity (txPsd);
+}
+
+
+void
+LteUePhy::SetSubChannelsForReception (std::vector <int> mask)
+{
+ NS_LOG_FUNCTION (this);
+ m_subChannelsForReception = mask;
+}
+
+
+std::vector <int>
+LteUePhy::GetSubChannelsForTransmission ()
+{
+ NS_LOG_FUNCTION (this);
+ return m_subChannelsForTransmission;
+}
+
+
+std::vector <int>
+LteUePhy::GetSubChannelsForReception ()
+{
+ NS_LOG_FUNCTION (this);
+ return m_subChannelsForReception;
+}
+
+
+Ptr<SpectrumValue>
+LteUePhy::CreateTxPowerSpectralDensity ()
+{
+ NS_LOG_FUNCTION (this);
+ LteSpectrumValueHelper psdHelper;
+ Ptr<SpectrumValue> psd = psdHelper.CreateUplinkTxPowerSpectralDensity (GetTxPower (), GetSubChannelsForTransmission ());
+
+ return psd;
+}
+
+void
+LteUePhy::GenerateCqiFeedback (const SpectrumValue& sinr)
+{
+ NS_LOG_FUNCTION (this);
+ if (Simulator::Now () > m_p10CqiLast + m_p10CqiPeriocity)
+ {
+ Ptr<LteUeNetDevice> thisDevice = GetDevice ()->GetObject<LteUeNetDevice> ();
+ Ptr<DlCqiIdealControlMessage> msg = CreateDlCqiFeedbackMessage (sinr);
+ DoSendIdealControlMessage (msg);
+ m_p10CqiLast = Simulator::Now ();
+ }
+}
+
+
+
+Ptr<DlCqiIdealControlMessage>
+LteUePhy::CreateDlCqiFeedbackMessage (const SpectrumValue& sinr)
+{
+ NS_LOG_FUNCTION (this);
+
+ std::vector<int> cqi = LteAmc::CreateCqiFeedbacks (sinr);
+
+ // CREATE CqiIdealControlMessage
+ Ptr<DlCqiIdealControlMessage> msg = Create<DlCqiIdealControlMessage> ();
+
+ int nbSubChannels = cqi.size ();
+ double cqiSum = 0.0;
+ for (int i = 0; i < nbSubChannels; i++)
+ {
+ cqiSum += cqi.at (i);
+ }
+ CqiListElement_s dlcqi;
+ dlcqi.m_rnti = m_rnti;
+ dlcqi.m_ri = 1; // not yet used
+ dlcqi.m_cqiType = CqiListElement_s::P10; // Peridic CQI using PUCCH wideband
+ dlcqi.m_wbCqi.push_back ((uint16_t) cqiSum / nbSubChannels);
+ dlcqi.m_wbPmi = 0; // not yet used
+ // dl.cqi.m_sbMeasResult others CQI report modes: not yet implemented
+
+ msg->SetDlCqi (dlcqi);
+ return msg;
+}
+
+
+
+void
+LteUePhy::DoSendIdealControlMessage (Ptr<IdealControlMessage> 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);
+ Ptr<LtePhy> phy = remoteDevice->GetPhy ();
+ phy->ReceiveIdealControlMessage (msg);
+}
+
+
+void
+LteUePhy::ReceiveIdealControlMessage (Ptr<IdealControlMessage> msg)
+{
+ NS_LOG_FUNCTION (this << msg);
+
+ if (msg->GetMessageType () == IdealControlMessage::DL_DCI)
+ {
+ Ptr<DlDciIdealControlMessage> msg2 = DynamicCast<DlDciIdealControlMessage> (msg);
+
+ DlDciListElement_s dci = msg2->GetDci ();
+
+ 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)
+ {
+ 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);
+ }
+
+ SetSubChannelsForReception (dlRb);
+
+
+ }
+ else if (msg->GetMessageType () == IdealControlMessage::UL_DCI)
+ {
+ // set the uplink bandwidht according to the UL-CQI
+ Ptr<UlDciIdealControlMessage> msg2 = DynamicCast<UlDciIdealControlMessage> (msg);
+ UlDciListElement_s dci = msg2->GetDci ();
+ 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);
+ }
+ SetSubChannelsForTransmission (ulRb);
+ // pass the info to the MAC
+ m_uePhySapUser->ReceiveIdealControlMessage (msg);
+ }
+ else
+ {
+ // pass the message to UE-MAC
+ m_uePhySapUser->ReceiveIdealControlMessage (msg);
+ }
+
+
+}
+
+
+void
+LteUePhy::SubframeIndication (uint32_t frameNo, uint32_t subframeNo)
+{
+ // trigger from eNB
+
+ // send control messages
+ std::list<Ptr<IdealControlMessage> > ctrlMsg = GetControlMessages ();
+ if (ctrlMsg.size () > 0)
+ {
+ 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 ();
+ }
+ }
+
+ // send packets in queue
+ // send the current burts of packets
+ Ptr<PacketBurst> pb = GetPacketBurst ();
+ if (pb)
+ {
+ GetUplinkSpectrumPhy ()->StartTx (pb);
+ }
+
+}
+
+
+void
+LteUePhy::SetTargetEnb (Ptr<LteEnbPhy> enbPhy)
+{
+ m_targetEnbPhy = enbPhy;
+}
+
+
+
+void
+LteUePhy::SetRnti (uint16_t rnti)
+{
+ NS_LOG_FUNCTION (this << rnti);
+ m_rnti = rnti;
+}
+
+
+
+} // namespace ns3
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/lte/model/lte-ue-phy.h Thu Mar 10 18:57:41 2011 +0100
@@ -0,0 +1,176 @@
+/* -*- 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 <mmiozzo@cttc.es>
+ */
+
+#ifndef LTE_UE_PHY_H
+#define LTE_UE_PHY_H
+
+
+#include <ns3/lte-phy.h>
+#include <ns3/ff-mac-common.h>
+
+#include <ns3/ideal-control-messages.h>
+#include <ns3/lte-amc.h>
+#include <ns3/lte-ue-phy-sap.h>
+#include <ns3/ptr.h>
+
+
+namespace ns3 {
+
+class PacketBurst;
+class LteNetDevice;
+class LteEnbPhy;
+
+/**
+ * The LteSpectrumPhy models the physical layer of LTE
+ */
+class LteUePhy : public LtePhy
+{
+
+ friend class UeMemberLteUePhySapProvider;
+
+public:
+
+ LteUePhy ();
+ virtual ~LteUePhy ();
+ virtual void DoDispose ();
+ static TypeId GetTypeId (void);
+
+
+ /**
+ * \brief Get the PHY SAP provider
+ * \return a pointer to the SAP Provider of the PHY
+ */
+ LteUePhySapProvider* GetLteUePhySapProvider ();
+
+ /**
+ * \brief Set the PHY SAP User
+ * \param s a pointer to the PHY SAP user
+ */
+ void SetLteUePhySapUser (LteUePhySapUser* s);
+
+ /**
+ * \brief Queue the MAC PDU to be sent
+ * \param p the MAC PDU to sent
+ */
+ virtual void DoSendMacPdu (Ptr<Packet> p);
+
+ /**
+ * \brief Create the PSD for the TX
+ * \return the pointer to the PSD
+ */
+ virtual Ptr<SpectrumValue> CreateTxPowerSpectralDensity ();
+
+ /**
+ * \brief Update available channel for TX
+ */
+ virtual void DoSetUplinkSubChannels ();
+
+ /**
+ * \brief Set a list of sub channels to use in TX
+ * \param mask a list of sub channels
+ */
+ void SetSubChannelsForTransmission (std::vector <int> mask);
+ /**
+ * \brief Get a list of sub channels to use in RX
+ * \return a list of sub channels
+ */
+ std::vector <int> GetSubChannelsForTransmission (void);
+
+ /**
+ * \brief Get a list of sub channels to use in RX
+ * \param mask list of sub channels
+ */
+ void SetSubChannelsForReception (std::vector <int> mask);
+ /**
+ * \brief Get a list of sub channels to use in RX
+ * \return a list of sub channels
+ */
+ std::vector <int> GetSubChannelsForReception (void);
+
+
+ /**
+ * \brief Create the DL CQI feedback from SINR values perceived at
+ * the physical layer with the signal received from eNB
+ * \param sinr SINR values vector
+ */
+ Ptr<DlCqiIdealControlMessage> CreateDlCqiFeedbackMessage (const SpectrumValue& sinr);
+
+
+
+ // inherited from LtePhy
+ virtual void GenerateCqiFeedback (const SpectrumValue& sinr);
+
+ virtual void DoSendIdealControlMessage (Ptr<IdealControlMessage> msg);
+ virtual void ReceiveIdealControlMessage (Ptr<IdealControlMessage> msg);
+
+
+
+ /**
+ * \brief PhySpectrum received a new PHY-PDU
+ */
+ void PhyPduReceived (Ptr<Packet> p);
+
+
+ /**
+ * \brief trigger from eNB the start from a new frame
+ *
+ * \param frameNo frame number
+ * \param subframeNo subframe number
+ */
+ void SubframeIndication (uint32_t frameNo, uint32_t subframeNo);
+
+
+ /**
+ * \param rnti the rnti assigned to the UE
+ */
+ void SetRnti (uint16_t rnti);
+
+
+ /**
+ * set the eNB this PHY is synchronized with
+ *
+ * \param enbPhy a pointer to the PHY of the eNB, used for exchanging control messages
+ * \param cellId the cell identifier of the eNB
+ */
+ void SetTargetEnb (Ptr<LteEnbPhy> enbPhy);
+
+
+private:
+ std::vector <int> m_subChannelsForTransmission;
+ std::vector <int> m_subChannelsForReception;
+
+ Time m_p10CqiPeriocity; /**< Wideband Periodic CQI: 2, 5, 10, 16, 20, 32, 40, 64, 80 or 160 ms */
+ Time m_p10CqiLast;
+
+ LteUePhySapProvider* m_uePhySapProvider;
+ LteUePhySapUser* m_uePhySapUser;
+
+ uint16_t m_rnti;
+
+ Ptr<LteEnbPhy> m_targetEnbPhy;
+ uint16_t m_cellId;
+
+};
+
+
+}
+
+#endif /* LTE_UE_PHY_H */
--- a/src/lte/model/rr-ff-mac-scheduler.cc Thu Mar 10 18:15:26 2011 +0100
+++ b/src/lte/model/rr-ff-mac-scheduler.cc Thu Mar 10 18:57:41 2011 +0100
@@ -21,7 +21,7 @@
#include <ns3/log.h>
#include <ns3/pointer.h>
-#include "amc-module.h"
+#include "lte-amc.h"
#include "rr-ff-mac-scheduler.h"
NS_LOG_COMPONENT_DEFINE ("RrPacketScheduler");
@@ -430,10 +430,10 @@
}
else
{
- newDci.m_mcs.push_back ( AmcModule::GetMcsFromCqi ((*it).second) );
+ newDci.m_mcs.push_back ( LteAmc::GetMcsFromCqi ((*it).second) );
}
int nPRB = rbgSize * rbgPerFlow;
- newDci.m_tbsSize.push_back ( (AmcModule::GetTbSizeFromMcs (newDci.m_mcs.at (i), nPRB) / 8) ); // (size of TB in bytes according to table 7.1.7.2.1-1 of 36.213)
+ newDci.m_tbsSize.push_back ( (LteAmc::GetTbSizeFromMcs (newDci.m_mcs.at (i), nPRB) / 8) ); // (size of TB in bytes according to table 7.1.7.2.1-1 of 36.213)
newDci.m_ndi.push_back (1); // TBD (new data indicator)
newDci.m_rv.push_back (0); // TBD (redundancy version)
@@ -549,7 +549,7 @@
uldci.m_rbLen = rbPerFlow;
rbAllocated += rbPerFlow;
uldci.m_mcs = 0; // MCS 0 -> UL-AMC TBD
- uldci.m_tbSize = (AmcModule::GetTbSizeFromMcs (uldci.m_mcs, rbPerFlow) / 8); // MCS 0 -> UL-AMC TBD
+ uldci.m_tbSize = (LteAmc::GetTbSizeFromMcs (uldci.m_mcs, rbPerFlow) / 8); // MCS 0 -> UL-AMC TBD
uldci.m_ndi = 1;
uldci.m_cceIndex = 0;
uldci.m_aggrLevel = 1;
--- a/src/lte/model/ue-net-device.cc Thu Mar 10 18:15:26 2011 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,187 +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>
- * Nicola Baldo <nbaldo@cttc.es>
- * Marco Miozzo <mmiozzo@cttc.es>
- */
-
-#include "ns3/llc-snap-header.h"
-#include "ns3/simulator.h"
-#include "ns3/callback.h"
-#include "ns3/node.h"
-#include "ns3/packet.h"
-#include "lte-net-device.h"
-#include "ns3/packet-burst.h"
-#include "ns3/uinteger.h"
-#include "ns3/trace-source-accessor.h"
-#include "ns3/pointer.h"
-#include "ns3/enum.h"
-#include "enb-net-device.h"
-#include "ue-net-device.h"
-#include "lte-ue-mac.h"
-#include "lte-ue-rrc.h"
-#include "ns3/ipv4-header.h"
-#include "ns3/ipv4.h"
-#include "amc-module.h"
-// #include "ideal-control-messages.h"
-#include <ns3/ue-phy.h>
-
-NS_LOG_COMPONENT_DEFINE ("UeNetDevice");
-
-namespace ns3 {
-
-NS_OBJECT_ENSURE_REGISTERED ( UeNetDevice);
-
-
-TypeId UeNetDevice::GetTypeId (void)
-{
- static TypeId
- tid =
- TypeId ("ns3::UeNetDevice")
- .SetParent<LteNetDevice> ();
- return tid;
-}
-
-
-UeNetDevice::UeNetDevice (void)
-{
- NS_LOG_FUNCTION (this);
- NS_FATAL_ERROR ("This constructor should not be called");
- InitUeNetDevice ();
-}
-
-
-UeNetDevice::UeNetDevice (Ptr<Node> node, Ptr<UeLtePhy> phy)
- : m_phy (phy)
-{
- NS_LOG_FUNCTION (this);
- InitUeNetDevice ();
- SetNode (node);
-
- /**
- * WILD HACK
- * to be translated to PHY-SAP primitive
- */
- phy->DoSetBandwidth (25,25);
-}
-
-UeNetDevice::~UeNetDevice (void)
-{
- NS_LOG_FUNCTION (this);
-}
-
-void
-UeNetDevice::DoDispose (void)
-{
- NS_LOG_FUNCTION (this);
- m_targetEnb = 0;
- m_mac->Dispose ();
- m_mac = 0;
- m_rrc->Dispose ();
- m_rrc = 0;
- m_phy->Dispose ();
- m_phy = 0;
- LteNetDevice::DoDispose ();
-}
-
-void
-UeNetDevice::InitUeNetDevice (void)
-{
- NS_LOG_FUNCTION (this);
- m_targetEnb = 0;
- SetNode (0);
- m_mac = CreateObject<LteUeMac> ();
- m_rrc = Create<LteUeRrc> ();
- m_rrc->SetLteUeCmacSapProvider (m_mac->GetLteUeCmacSapProvider ());
- m_mac->SetLteUeCmacSapUser (m_rrc->GetLteUeCmacSapUser ());
- m_rrc->SetLteMacSapProvider (m_mac->GetLteMacSapProvider ());
- m_phy->SetLteUePhySapUser (m_mac->GetLteUePhySapUser ());
- m_mac->SetLteUePhySapProvider (m_phy->GetLteUePhySapProvider ());
-}
-
-
-
-Ptr<LteUeMac>
-UeNetDevice::GetMac (void)
-{
- NS_LOG_FUNCTION (this);
- return m_mac;
-}
-
-
-Ptr<LteUeRrc>
-UeNetDevice::GetRrc (void)
-{
- NS_LOG_FUNCTION (this);
- return m_rrc;
-}
-
-
-Ptr<UeLtePhy>
-UeNetDevice::GetPhy (void) const
-{
- NS_LOG_FUNCTION (this);
- return m_phy;
-}
-
-void
-UeNetDevice::SetTargetEnb (Ptr<EnbNetDevice> enb)
-{
- NS_LOG_FUNCTION (this << enb);
- m_targetEnb = enb;
-}
-
-
-Ptr<EnbNetDevice>
-UeNetDevice::GetTargetEnb (void)
-{
- NS_LOG_FUNCTION (this);
- return m_targetEnb;
-}
-
-
-bool
-UeNetDevice::DoSend (Ptr<Packet> packet, const Mac48Address& source,
- const Mac48Address& dest, uint16_t protocolNumber)
-{
- NS_LOG_FUNCTION (this);
-
- NS_FATAL_ERROR ("IP connectivity not implemented yet");
-
- return (true);
-}
-
-
-void
-UeNetDevice::DoReceive (Ptr<Packet> p)
-{
- NS_LOG_FUNCTION (this << p);
-
- NS_FATAL_ERROR ("IP connectivity not implemented yet");
-
- Ptr<Packet> packet = p->Copy ();
-
- LlcSnapHeader llcHdr;
- packet->RemoveHeader (llcHdr);
- NS_LOG_FUNCTION (this << llcHdr);
-
- ForwardUp (packet);
-}
-
-
-} // namespace ns3
--- a/src/lte/model/ue-net-device.h Thu Mar 10 18:15:26 2011 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,107 +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>
- * Nicola Baldo <nbaldo@cttc.es>
- */
-
-#ifndef UE_NET_DEVICE_H
-#define UE_NET_DEVICE_H
-
-#include "lte-net-device.h"
-#include "ns3/event-id.h"
-#include "ns3/mac48-address.h"
-#include "ns3/traced-callback.h"
-#include "ns3/nstime.h"
-#include "ns3/log.h"
-#include "lte-phy.h"
-#include "lte-phy.h"
-
-
-namespace ns3 {
-
-class Packet;
-class PacketBurst;
-class Node;
-class LtePhy;
-class UeLtePhy;
-class EnbNetDevice;
-class LteUeMac;
-class LteUeRrc;
-
-/**
- * The UeNetDevice class implements the UE net device
- */
-class UeNetDevice : public LteNetDevice
-{
-public:
- static TypeId GetTypeId (void);
-
- UeNetDevice (void);
- /**
- * \brief Create an UE net device
- * \param node
- * \param phy
- */
- UeNetDevice (Ptr<Node> node, Ptr<UeLtePhy> phy);
-
- virtual ~UeNetDevice (void);
- virtual void DoDispose ();
-
-
- Ptr<LteUeMac> GetMac (void);
-
- Ptr<LteUeRrc> GetRrc ();
-
- Ptr<UeLtePhy> GetPhy (void) const;
-
- /**
- * \brief Initialize the UE
- */
-
- void InitUeNetDevice (void);
-
- /**
- * \brief Set the targer eNB where the UE is registered
- * \param enb
- */
- void SetTargetEnb (Ptr<EnbNetDevice> enb);
- /**
- * \brief Get the targer eNB where the UE is registered
- * \return the pointer to the enb
- */
- Ptr<EnbNetDevice> GetTargetEnb (void);
-
-
-private:
- bool DoSend (Ptr<Packet> packet,
- const Mac48Address& source,
- const Mac48Address& dest,
- uint16_t protocolNumber);
-
- void DoReceive (Ptr<Packet> p);
-
- Ptr<EnbNetDevice> m_targetEnb;
-
- Ptr<LteUeMac> m_mac;
- Ptr<UeLtePhy> m_phy;
- Ptr<LteUeRrc> m_rrc;
-};
-
-} // namespace ns3
-
-#endif /* UE_NET_DEVICE_H */
--- a/src/lte/model/ue-phy.cc Thu Mar 10 18:15:26 2011 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,384 +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>
- * Nicola Baldo <nbaldo@cttc.es>
- */
-
-#include <ns3/object-factory.h>
-#include <ns3/log.h>
-#include <math.h>
-#include <ns3/simulator.h>
-#include <ns3/spectrum-error-model.h>
-#include "ue-phy.h"
-#include "enb-phy.h"
-#include "lte-net-device.h"
-#include "ue-net-device.h"
-#include "enb-net-device.h"
-#include "lte-spectrum-value-helper.h"
-#include "amc-module.h"
-#include "lte-ue-mac.h"
-#include "ff-mac-common.h"
-#include "lte-sinr-chunk-processor.h"
-
-
-NS_LOG_COMPONENT_DEFINE ("UeLtePhy");
-
-namespace ns3 {
-
-////////////////////////////////////////
-// member SAP forwarders
-////////////////////////////////////////
-
-
-class UeMemberUeLtePhySapProvider : public LteUePhySapProvider
-{
-public:
- UeMemberUeLtePhySapProvider (UeLtePhy* phy);
-
- // inherited from LtePhySapProvider
- virtual void SendMacPdu (Ptr<Packet> p);
- virtual void SetBandwidth (uint8_t ulBandwidth, uint8_t dlBandwidth);
- virtual void SendIdealControlMessage (Ptr<IdealControlMessage> msg);
-
-private:
- UeLtePhy* m_phy;
-};
-
-UeMemberUeLtePhySapProvider::UeMemberUeLtePhySapProvider (UeLtePhy* phy) : m_phy (phy)
-{
-
-}
-
-
-void
-UeMemberUeLtePhySapProvider::SendMacPdu (Ptr<Packet> p)
-{
- m_phy->DoSendMacPdu (p);
-}
-
-void
-UeMemberUeLtePhySapProvider::SetBandwidth (uint8_t ulBandwidth, uint8_t dlBandwidth)
-{
- m_phy->DoSetBandwidth (ulBandwidth, dlBandwidth);
-}
-
-void
-UeMemberUeLtePhySapProvider::SendIdealControlMessage (Ptr<IdealControlMessage> msg)
-{
- m_phy->DoSendIdealControlMessage (msg);
-}
-
-
-
-////////////////////////////////////////
-// generic UeLtePhy methods
-////////////////////////////////////////
-
-
-NS_OBJECT_ENSURE_REGISTERED (UeLtePhy);
-
-
-UeLtePhy::UeLtePhy ()
- : m_p10CqiPeriocity (MilliSeconds (2)),
- m_p10CqiLast (MilliSeconds (0))
-{
- m_uePhySapProvider = new UeMemberUeLtePhySapProvider (this);
-}
-
-
-UeLtePhy::~UeLtePhy ()
-{
-}
-
-void
-UeLtePhy::DoDispose ()
-{
-}
-
-
-
-TypeId
-UeLtePhy::GetTypeId (void)
-{
- static TypeId tid = TypeId ("ns3::UeLtePhy")
- .SetParent<LtePhy> ()
- .AddConstructor<UeLtePhy> ()
- ;
- return tid;
-}
-
-
-void
-UeLtePhy::SetLteUePhySapUser (LteUePhySapUser* s)
-{
- m_uePhySapUser = s;
-}
-
-LteUePhySapProvider*
-UeLtePhy::GetLteUePhySapProvider ()
-{
- return (m_uePhySapProvider);
-}
-
-
-void
-UeLtePhy::DoSendMacPdu (Ptr<Packet> p)
-{
- NS_LOG_FUNCTION (this);
-
- SetMacPdu (p);
-}
-
-
-void
-UeLtePhy::PhyPduReceived (Ptr<Packet> p)
-{
- m_uePhySapUser->ReceivePhyPdu (p);
-}
-
-void
-UeLtePhy::DoSetUplinkSubChannels ()
-{
- NS_LOG_FUNCTION (this);
-
- /*
- * XXX: the uplink scheduler is not implemented yet!
- * Now, all uplink sub channels can be used for uplink transmission
- */
- SetSubChannelsForTransmission (GetUplinkSubChannels ());
-}
-
-
-void
-UeLtePhy::SetSubChannelsForTransmission (std::vector <int> mask)
-{
- NS_LOG_FUNCTION (this);
-
- m_subChannelsForTransmission = mask;
-
- Ptr<SpectrumValue> txPsd = CreateTxPowerSpectralDensity ();
- GetUplinkSpectrumPhy ()->SetTxPowerSpectralDensity (txPsd);
-}
-
-
-void
-UeLtePhy::SetSubChannelsForReception (std::vector <int> mask)
-{
- NS_LOG_FUNCTION (this);
- m_subChannelsForReception = mask;
-}
-
-
-std::vector <int>
-UeLtePhy::GetSubChannelsForTransmission ()
-{
- NS_LOG_FUNCTION (this);
- return m_subChannelsForTransmission;
-}
-
-
-std::vector <int>
-UeLtePhy::GetSubChannelsForReception ()
-{
- NS_LOG_FUNCTION (this);
- return m_subChannelsForReception;
-}
-
-
-Ptr<SpectrumValue>
-UeLtePhy::CreateTxPowerSpectralDensity ()
-{
- NS_LOG_FUNCTION (this);
- LteSpectrumValueHelper psdHelper;
- Ptr<SpectrumValue> psd = psdHelper.CreateUplinkTxPowerSpectralDensity (GetTxPower (), GetSubChannelsForTransmission ());
-
- return psd;
-}
-
-void
-UeLtePhy::GenerateCqiFeedback (const SpectrumValue& sinr)
-{
- NS_LOG_FUNCTION (this);
- if (Simulator::Now () > m_p10CqiLast + m_p10CqiPeriocity)
- {
- Ptr<UeNetDevice> thisDevice = GetDevice ()->GetObject<UeNetDevice> ();
- Ptr<DlCqiIdealControlMessage> msg = CreateDlCqiFeedbackMessage (sinr);
- DoSendIdealControlMessage (msg);
- m_p10CqiLast = Simulator::Now ();
- }
-}
-
-
-
-Ptr<DlCqiIdealControlMessage>
-UeLtePhy::CreateDlCqiFeedbackMessage (const SpectrumValue& sinr)
-{
- NS_LOG_FUNCTION (this);
-
- std::vector<int> cqi = AmcModule::CreateCqiFeedbacks (sinr);
-
- // CREATE CqiIdealControlMessage
- Ptr<DlCqiIdealControlMessage> msg = Create<DlCqiIdealControlMessage> ();
-
- int nbSubChannels = cqi.size ();
- double cqiSum = 0.0;
- for (int i = 0; i < nbSubChannels; i++)
- {
- cqiSum += cqi.at (i);
- }
- CqiListElement_s dlcqi;
- dlcqi.m_rnti = m_rnti;
- dlcqi.m_ri = 1; // not yet used
- dlcqi.m_cqiType = CqiListElement_s::P10; // Peridic CQI using PUCCH wideband
- dlcqi.m_wbCqi.push_back ((uint16_t) cqiSum / nbSubChannels);
- dlcqi.m_wbPmi = 0; // not yet used
- // dl.cqi.m_sbMeasResult others CQI report modes: not yet implemented
-
- msg->SetDlCqi (dlcqi);
- return msg;
-}
-
-
-
-void
-UeLtePhy::DoSendIdealControlMessage (Ptr<IdealControlMessage> msg)
-{
- NS_LOG_FUNCTION (this << msg);
- Ptr<UeNetDevice> thisDevice = GetDevice ()->GetObject<UeNetDevice> ();
- Ptr<EnbNetDevice> remoteDevice = thisDevice->GetTargetEnb ();
- msg->SetSourceDevice (thisDevice);
- msg->SetDestinationDevice (remoteDevice);
- SetControlMessages (msg);
- Ptr<LtePhy> phy = remoteDevice->GetPhy ();
- phy->ReceiveIdealControlMessage (msg);
-}
-
-
-void
-UeLtePhy::ReceiveIdealControlMessage (Ptr<IdealControlMessage> msg)
-{
- NS_LOG_FUNCTION (this << msg);
-
- if (msg->GetMessageType () == IdealControlMessage::DL_DCI)
- {
- Ptr<DlDciIdealControlMessage> msg2 = DynamicCast<DlDciIdealControlMessage> (msg);
-
- DlDciListElement_s dci = msg2->GetDci ();
-
- 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)
- {
- 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);
- }
-
- SetSubChannelsForReception (dlRb);
-
-
- }
- else if (msg->GetMessageType () == IdealControlMessage::UL_DCI)
- {
- // set the uplink bandwidht according to the UL-CQI
- Ptr<UlDciIdealControlMessage> msg2 = DynamicCast<UlDciIdealControlMessage> (msg);
- UlDciListElement_s dci = msg2->GetDci ();
- 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);
- }
- SetSubChannelsForTransmission (ulRb);
- // pass the info to the MAC
- m_uePhySapUser->ReceiveIdealControlMessage (msg);
- }
- else
- {
- // pass the message to UE-MAC
- m_uePhySapUser->ReceiveIdealControlMessage (msg);
- }
-
-
-}
-
-
-void
-UeLtePhy::SubframeIndication (uint32_t frameNo, uint32_t subframeNo)
-{
- // trigger from eNB
-
- // send control messages
- std::list<Ptr<IdealControlMessage> > ctrlMsg = GetControlMessages ();
- if (ctrlMsg.size () > 0)
- {
- Ptr<LtePhy> phy = GetDevice ()->GetObject<UeNetDevice> ()->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 ();
- }
- }
-
- // send packets in queue
- // send the current burts of packets
- Ptr<PacketBurst> pb = GetPacketBurst ();
- if (pb)
- {
- GetUplinkSpectrumPhy ()->StartTx (pb);
- }
-
-}
-
-
-void
-UeLtePhy::SetTargetEnb (Ptr<EnbLtePhy> enbPhy)
-{
- m_targetEnbPhy = enbPhy;
-}
-
-
-
-void
-UeLtePhy::SetRnti (uint16_t rnti)
-{
- NS_LOG_FUNCTION (this << rnti);
- m_rnti = rnti;
-}
-
-
-
-} // namespace ns3
--- a/src/lte/model/ue-phy.h Thu Mar 10 18:15:26 2011 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,176 +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 <mmiozzo@cttc.es>
- */
-
-#ifndef UE_PHY_H
-#define UE_PHY_H
-
-
-#include <ns3/lte-phy.h>
-#include <ns3/ff-mac-common.h>
-
-#include <ns3/ideal-control-messages.h>
-#include <ns3/amc-module.h>
-#include <ns3/lte-ue-phy-sap.h>
-#include <ns3/ptr.h>
-
-
-namespace ns3 {
-
-class PacketBurst;
-class LteNetDevice;
-class EnbLtePhy;
-
-/**
- * The LteSpectrumPhy models the physical layer of LTE
- */
-class UeLtePhy : public LtePhy
-{
-
- friend class UeMemberUeLtePhySapProvider;
-
-public:
-
- UeLtePhy ();
- virtual ~UeLtePhy ();
- virtual void DoDispose ();
- static TypeId GetTypeId (void);
-
-
- /**
- * \brief Get the PHY SAP provider
- * \return a pointer to the SAP Provider of the PHY
- */
- LteUePhySapProvider* GetLteUePhySapProvider ();
-
- /**
- * \brief Set the PHY SAP User
- * \param s a pointer to the PHY SAP user
- */
- void SetLteUePhySapUser (LteUePhySapUser* s);
-
- /**
- * \brief Queue the MAC PDU to be sent
- * \param p the MAC PDU to sent
- */
- virtual void DoSendMacPdu (Ptr<Packet> p);
-
- /**
- * \brief Create the PSD for the TX
- * \return the pointer to the PSD
- */
- virtual Ptr<SpectrumValue> CreateTxPowerSpectralDensity ();
-
- /**
- * \brief Update available channel for TX
- */
- virtual void DoSetUplinkSubChannels ();
-
- /**
- * \brief Set a list of sub channels to use in TX
- * \param mask a list of sub channels
- */
- void SetSubChannelsForTransmission (std::vector <int> mask);
- /**
- * \brief Get a list of sub channels to use in RX
- * \return a list of sub channels
- */
- std::vector <int> GetSubChannelsForTransmission (void);
-
- /**
- * \brief Get a list of sub channels to use in RX
- * \param mask list of sub channels
- */
- void SetSubChannelsForReception (std::vector <int> mask);
- /**
- * \brief Get a list of sub channels to use in RX
- * \return a list of sub channels
- */
- std::vector <int> GetSubChannelsForReception (void);
-
-
- /**
- * \brief Create the DL CQI feedback from SINR values perceived at
- * the physical layer with the signal received from eNB
- * \param sinr SINR values vector
- */
- Ptr<DlCqiIdealControlMessage> CreateDlCqiFeedbackMessage (const SpectrumValue& sinr);
-
-
-
- // inherited from LtePhy
- virtual void GenerateCqiFeedback (const SpectrumValue& sinr);
-
- virtual void DoSendIdealControlMessage (Ptr<IdealControlMessage> msg);
- virtual void ReceiveIdealControlMessage (Ptr<IdealControlMessage> msg);
-
-
-
- /**
- * \brief PhySpectrum received a new PHY-PDU
- */
- void PhyPduReceived (Ptr<Packet> p);
-
-
- /**
- * \brief trigger from eNB the start from a new frame
- *
- * \param frameNo frame number
- * \param subframeNo subframe number
- */
- void SubframeIndication (uint32_t frameNo, uint32_t subframeNo);
-
-
- /**
- * \param rnti the rnti assigned to the UE
- */
- void SetRnti (uint16_t rnti);
-
-
- /**
- * set the eNB this PHY is synchronized with
- *
- * \param enbPhy a pointer to the PHY of the eNB, used for exchanging control messages
- * \param cellId the cell identifier of the eNB
- */
- void SetTargetEnb (Ptr<EnbLtePhy> enbPhy);
-
-
-private:
- std::vector <int> m_subChannelsForTransmission;
- std::vector <int> m_subChannelsForReception;
-
- Time m_p10CqiPeriocity; /**< Wideband Periodic CQI: 2, 5, 10, 16, 20, 32, 40, 64, 80 or 160 ms */
- Time m_p10CqiLast;
-
- LteUePhySapProvider* m_uePhySapProvider;
- LteUePhySapUser* m_uePhySapUser;
-
- uint16_t m_rnti;
-
- Ptr<EnbLtePhy> m_targetEnbPhy;
- uint16_t m_cellId;
-
-};
-
-
-}
-
-#endif /* UE_PHY_H */
--- a/src/lte/wscript Thu Mar 10 18:15:26 2011 +0100
+++ b/src/lte/wscript Thu Mar 10 18:57:41 2011 +0100
@@ -6,8 +6,8 @@
module.source = [
'model/lte-spectrum-phy.cc',
'model/lte-phy.cc',
- 'model/enb-phy.cc',
- 'model/ue-phy.cc',
+ 'model/lte-enb-phy.cc',
+ 'model/lte-ue-phy.cc',
'model/lte-spectrum-value-helper.cc',
'model/lte-propagation-loss-model.cc',
'model/discrete-time-loss-model.cc',
@@ -16,14 +16,14 @@
'model/path-loss-model.cc',
'model/jakes-fading-loss-model.cc',
'model/channel-realization.cc',
- 'model/amc-module.cc',
+ 'model/lte-amc.cc',
'model/lte-enb-rrc.cc',
'model/lte-ue-rrc.cc',
'model/lte-rlc.cc',
'model/eps-bearer.cc',
'model/lte-net-device.cc',
- 'model/enb-net-device.cc',
- 'model/ue-net-device.cc',
+ 'model/lte-enb-net-device.cc',
+ 'model/lte-ue-net-device.cc',
'model/ideal-control-messages.cc',
'helper/lena-helper.cc',
'model/ff-mac-csched-sap.cc',
@@ -45,8 +45,8 @@
headers.source = [
'model/lte-spectrum-phy.h',
'model/lte-phy.h',
- 'model/enb-phy.h',
- 'model/ue-phy.h',
+ 'model/lte-enb-phy.h',
+ 'model/lte-ue-phy.h',
'model/lte-spectrum-value-helper.h',
'model/lte-propagation-loss-model.h',
'model/discrete-time-loss-model.h',
@@ -55,14 +55,14 @@
'model/path-loss-model.h',
'model/jakes-fading-loss-model.h',
'model/channel-realization.h',
- 'model/amc-module.h',
+ 'model/lte-amc.h',
'model/lte-enb-rrc.h',
'model/lte-ue-rrc.h',
'model/lte-rlc.h',
'model/eps-bearer.h',
'model/lte-net-device.h',
- 'model/enb-net-device.h',
- 'model/ue-net-device.h',
+ 'model/lte-enb-net-device.h',
+ 'model/lte-ue-net-device.h',
'model/ideal-control-messages.h',
'helper/lena-helper.h',
'model/ff-mac-common.h',