Add SRS based UL-CQI and update RR and PF schedulers for managing them

This commit is contained in:
Marco Miozzo
2012-06-28 17:30:43 +02:00
parent 655b60481d
commit db24c8d062
13 changed files with 222 additions and 58 deletions

View File

@@ -318,11 +318,10 @@ LteHelper::InstallSingleEnbDevice (Ptr<Node> n)
Ptr<LteEnbPhy> phy = CreateObject<LteEnbPhy> (dlPhy, ulPhy);
Ptr<LteCtrlSinrChunkProcessor> pCtrl = Create<LteCtrlSinrChunkProcessor> (phy->GetObject<LtePhy> ());
// CQIs are still evaluated with PUSCH, this will be used for SRS ones
// ulPhy->AddDataSinrChunkProcessor (pCtrl);
ulPhy->AddCtrlSinrChunkProcessor (pCtrl); // for evaluating SRS UL-CQI
Ptr<LteDataSinrChunkProcessor> pData = Create<LteDataSinrChunkProcessor> (ulPhy, phy);
ulPhy->AddDataSinrChunkProcessor (pData);
ulPhy->AddDataSinrChunkProcessor (pData); // for evaluating PUSCH UL-CQI
dlPhy->SetChannel (m_downlinkChannel);
ulPhy->SetChannel (m_uplinkChannel);

View File

@@ -0,0 +1,40 @@
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2011 CTTC
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Author: Marco Miozzo <mmiozzo@cttc.es>
*/
#include <ns3/ff-mac-common.h>
namespace ns3 {
VendorSpecificValue::VendorSpecificValue ()
{
}
VendorSpecificValue::~VendorSpecificValue ()
{
}
// VendorSpecificValue::VendorSpecificValue (const VendorSpecificValue& p)
// {
// // remember to copy new parameters???
// }
} // namespace ns3

View File

@@ -21,6 +21,11 @@
#ifndef FF_MAC_COMMON_H
#define FF_MAC_COMMON_H
#include <ns3/simple-ref-count.h>
#include <ns3/ptr.h>
#include <vector>
/**
* Constants. See section 4.4
*/
@@ -49,6 +54,7 @@
#define MAX_SR_LIST 30
#define MAX_MAC_CE_LIST 30
namespace ns3 {
enum Result_e
{
@@ -142,6 +148,22 @@ struct UlDciListElement_s
int8_t m_pdcchPowerOffset;
};
/**
* \brief Template class for storing the values of vendor specific parameters
*/
struct VendorSpecificValue : public SimpleRefCount<VendorSpecificValue>
{
VendorSpecificValue ();
virtual ~VendorSpecificValue ();
/**
* copy constructor
*/
// do we need it? it seems that it works without it
// VendorSpecificValue (const VendorSpecificValue& p); // do we need it?
};
/**
* \brief See section 4.3.3 vendorSpecifiListElement
*/
@@ -149,7 +171,7 @@ struct VendorSpecificListElement_s
{
uint32_t m_type;
uint32_t m_length;
void *m_value;
Ptr<VendorSpecificValue> m_value;
};
/**
@@ -464,5 +486,6 @@ struct PagingInfoListElement_s
uint8_t m_pagingSubframe;
};
} // namespace ns3
#endif /* FF_MAC_COMMON_H */

View File

@@ -21,6 +21,8 @@
#include "ff-mac-scheduler.h"
#include <ns3/log.h>
#include <ns3/enum.h>
NS_LOG_COMPONENT_DEFINE ("FfMacScheduler");
@@ -29,6 +31,13 @@ namespace ns3 {
NS_OBJECT_ENSURE_REGISTERED (FfMacScheduler);
FfMacScheduler::FfMacScheduler ()
: m_ulCqiFilter (ALL)
{
NS_LOG_FUNCTION (this);
}
FfMacScheduler::~FfMacScheduler ()
{
NS_LOG_FUNCTION (this);
@@ -44,10 +53,19 @@ TypeId
FfMacScheduler::GetTypeId (void)
{
static TypeId tid = TypeId ("ns3::FfMacScheduler")
.SetParent<Object> ();
.SetParent<Object> ()
.AddAttribute ("UlCqiFilter",
"The filter to apply on UL CQIs received",
EnumValue (FfMacScheduler::ALL),
MakeEnumAccessor (&FfMacScheduler::m_ulCqiFilter),
MakeEnumChecker (FfMacScheduler::SRS, "SRS",
FfMacScheduler::PUSCH, "PUSCH",
FfMacScheduler::ALL, "ALL"))
;
return tid;
}
} // namespace ns3

View File

@@ -44,6 +44,22 @@ class FfMacSchedSapProvider;
class FfMacScheduler : public Object
{
public:
/**
* The type of UL CQI to be filtered (ALL means accept all the CQI,
* where a new CQI of any type overwrite the old one, even of another type)
*
*/
enum UlCqiFilter_t
{
SRS,
PUSCH,
ALL
};
/**
* constructor
*
*/
FfMacScheduler ();
/**
* destructor
*
@@ -83,6 +99,11 @@ public:
*/
virtual FfMacSchedSapProvider* GetFfMacSchedSapProvider () = 0;
protected:
UlCqiFilter_t m_ulCqiFilter;
};
} // namespace ns3

View File

@@ -226,7 +226,7 @@ public:
virtual void ReceivePhyPdu (Ptr<Packet> p);
virtual void SubframeIndication (uint32_t frameNo, uint32_t subframeNo);
virtual void ReceiveLteControlMessage (Ptr<LteControlMessage> msg);
virtual void UlCqiReport (UlCqi_s ulcqi);
virtual void UlCqiReport (FfMacSchedSapProvider::SchedUlCqiInfoReqParameters ulcqi);
private:
LteEnbMac* m_mac;
@@ -256,7 +256,7 @@ EnbMacMemberLteEnbPhySapUser::ReceiveLteControlMessage (Ptr<LteControlMessage> m
}
void
EnbMacMemberLteEnbPhySapUser::UlCqiReport (UlCqi_s ulcqi)
EnbMacMemberLteEnbPhySapUser::UlCqiReport (FfMacSchedSapProvider::SchedUlCqiInfoReqParameters ulcqi)
{
m_mac->DoUlCqiReport (ulcqi);
}
@@ -407,8 +407,6 @@ LteEnbMac::DoSubframeIndication (uint32_t frameNo, uint32_t subframeNo)
// Get downlink transmission opportunities
// uint32_t dlSchedFrameNo = (0x3FF & (m_frameNo >> 4));
// uint32_t dlSchedSubframeNo = (0xF & m_subframeNo);
uint32_t dlSchedFrameNo = m_frameNo;
uint32_t dlSchedSubframeNo = m_subframeNo;
// NS_LOG_DEBUG (this << " sfn " << frameNo << " sbfn " << subframeNo);
@@ -428,32 +426,20 @@ LteEnbMac::DoSubframeIndication (uint32_t frameNo, uint32_t subframeNo)
// --- UPLINK ---
// Send UL-CQI info to the scheduler
if (m_ulCqiReceived.size () > 0)
std::vector <FfMacSchedSapProvider::SchedUlCqiInfoReqParameters>::iterator itCqi;
for (uint16_t i = 0; i < m_ulCqiReceived.size (); i++)
{
FfMacSchedSapProvider::SchedUlCqiInfoReqParameters ulcqiInfoReq;
if (subframeNo>1)
{
ulcqiInfoReq.m_sfnSf = ((0x3FF & frameNo) << 4) | (0xF & subframeNo);
m_ulCqiReceived.at (i).m_sfnSf = ((0x3FF & frameNo) << 4) | (0xF & subframeNo);
}
else
{
ulcqiInfoReq.m_sfnSf = ((0x3FF & (frameNo-1)) << 4) | (0xF & 10);
}
int cqiNum = m_ulCqiReceived.size ();
if (cqiNum >= 1)
{
ulcqiInfoReq.m_ulCqi = m_ulCqiReceived.at (cqiNum - 1);
if (cqiNum > 1)
{
// empty old ul cqi
while (m_ulCqiReceived.size () > 0)
{
m_ulCqiReceived.pop_back ();
}
}
m_schedSapProvider->SchedUlCqiInfoReq (ulcqiInfoReq);
m_ulCqiReceived.at (i).m_sfnSf = ((0x3FF & (frameNo-1)) << 4) | (0xF & 10);
}
m_schedSapProvider->SchedUlCqiInfoReq (m_ulCqiReceived.at (i));
}
m_ulCqiReceived.clear ();
// Send BSR reports to the scheduler
if (m_ulCeReceived.size () > 0)
@@ -477,7 +463,6 @@ LteEnbMac::DoSubframeIndication (uint32_t frameNo, uint32_t subframeNo)
}
else
{
// ulSchedSubframeNo = (ulSchedSubframeNo + (2*m_macChTtiDelay)) % 11;
ulSchedSubframeNo = ulSchedSubframeNo + (m_macChTtiDelay+UL_PUSCH_TTIS_DELAY);
}
FfMacSchedSapProvider::SchedUlTriggerReqParameters ulparams;
@@ -494,7 +479,6 @@ LteEnbMac::DoSubframeIndication (uint32_t frameNo, uint32_t subframeNo)
// reset UL info
//std::map <uint16_t,UlInfoListElement_s>::iterator it;
for (it = m_ulInfoListElements.begin (); it != m_ulInfoListElements.end (); it++)
{
for (uint16_t i = 0; i < (*it).second.m_ulReception.size (); i++)
@@ -528,9 +512,9 @@ LteEnbMac::DoReceiveLteControlMessage (Ptr<LteControlMessage> msg)
void
LteEnbMac::DoUlCqiReport (UlCqi_s ulcqi)
LteEnbMac::DoUlCqiReport (FfMacSchedSapProvider::SchedUlCqiInfoReqParameters ulcqi)
{
if (ulcqi.m_type == UlCqi_s::PUSCH)
if (ulcqi.m_ulCqi.m_type == UlCqi_s::PUSCH)
{
NS_LOG_DEBUG (this << " eNB rxed an PUSCH UL-CQI");
}

View File

@@ -133,7 +133,7 @@ public:
*/
void ReceiveBsrMessage (MacCeListElement_s bsr);
void DoUlCqiReport (UlCqi_s ulcqi);
void DoUlCqiReport (FfMacSchedSapProvider::SchedUlCqiInfoReqParameters ulcqi);
@@ -184,11 +184,10 @@ public:
private:
private:
// std::map <uint16_t, std::map <uint8_t,Ptr<LteMacSapUser> > > m_rlcAttached;
std::map <LteFlowId_t, LteMacSapUser*> m_rlcAttached;
std::vector <CqiListElement_s> m_dlCqiReceived; // DL-CQI received
std::vector <UlCqi_s> m_ulCqiReceived; // UL-CQI received
std::vector <FfMacSchedSapProvider::SchedUlCqiInfoReqParameters> m_ulCqiReceived; // UL-CQI received
std::vector <MacCeListElement_s> m_ulCeReceived; // CE received (BSR up to now)

View File

@@ -25,6 +25,7 @@
#include <ns3/packet.h>
#include <ns3/ff-mac-common.h>
#include <ns3/ff-mac-sched-sap.h>
namespace ns3 {
@@ -125,7 +126,7 @@ public:
* \brief Returns to MAC level the UL-CQI evaluated
* \param ulcqi the UL-CQI (see FF MAC API 4.3.29)
*/
virtual void UlCqiReport (UlCqi_s ulcqi) = 0;
virtual void UlCqiReport (FfMacSchedSapProvider::SchedUlCqiInfoReqParameters ulcqi) = 0;
};

View File

@@ -34,6 +34,7 @@
#include "lte-enb-net-device.h"
#include "lte-enb-mac.h"
#include <ns3/lte-common.h>
#include <ns3/lte-vendor-specific-parameters.h>
NS_LOG_COMPONENT_DEFINE ("LteEnbPhy");
@@ -133,7 +134,8 @@ LteEnbPhy::LteEnbPhy (Ptr<LteSpectrumPhy> dlPhy, Ptr<LteSpectrumPhy> ulPhy)
: LtePhy (dlPhy, ulPhy),
m_nrFrames (0),
m_nrSubFrames (0),
m_srsPeriodicity (0)
m_srsPeriodicity (0),
m_currentSrsOffset (0)
{
m_enbPhySapProvider = new EnbMemberLteEnbPhySapProvider (this);
Simulator::ScheduleNow (&LteEnbPhy::StartFrame, this);
@@ -183,6 +185,7 @@ LteEnbPhy::DoDispose ()
{
NS_LOG_FUNCTION (this);
m_ueAttached.clear ();
m_srsUeOffset.clear ();
delete m_enbPhySapProvider;
LtePhy::DoDispose ();
}
@@ -397,6 +400,7 @@ LteEnbPhy::StartSubFrame (void)
NS_LOG_FUNCTION (this);
++m_nrSubFrames;
m_currentSrsOffset = (m_currentSrsOffset + 1) % m_srsPeriodicity;
NS_LOG_INFO ("-----sub frame " << m_nrSubFrames << "-----");
@@ -558,7 +562,7 @@ void
LteEnbPhy::GenerateCtrlCqiReport (const SpectrumValue& sinr)
{
NS_LOG_FUNCTION (this << sinr);
UlCqi_s ulcqi = CreateSrsCqiReport (sinr);
FfMacSchedSapProvider::SchedUlCqiInfoReqParameters ulcqi = CreateSrsCqiReport (sinr);
m_enbPhySapUser->UlCqiReport (ulcqi);
}
@@ -566,19 +570,19 @@ void
LteEnbPhy::GenerateDataCqiReport (const SpectrumValue& sinr)
{
NS_LOG_FUNCTION (this << sinr);
UlCqi_s ulcqi = CreatePuschCqiReport (sinr);
FfMacSchedSapProvider::SchedUlCqiInfoReqParameters ulcqi = CreatePuschCqiReport (sinr);
m_enbPhySapUser->UlCqiReport (ulcqi);
}
UlCqi_s
FfMacSchedSapProvider::SchedUlCqiInfoReqParameters
LteEnbPhy::CreatePuschCqiReport (const SpectrumValue& sinr)
{
NS_LOG_FUNCTION (this << sinr);
Values::const_iterator it;
UlCqi_s ulcqi;
ulcqi.m_type = UlCqi_s::PUSCH;
FfMacSchedSapProvider::SchedUlCqiInfoReqParameters ulcqi;
ulcqi.m_ulCqi.m_type = UlCqi_s::PUSCH;
int i = 0;
for (it = sinr.ConstValuesBegin (); it != sinr.ConstValuesEnd (); it++)
{
@@ -586,7 +590,7 @@ LteEnbPhy::CreatePuschCqiReport (const SpectrumValue& sinr)
// NS_LOG_DEBUG ("ULCQI RB " << i << " value " << sinrdb);
// convert from double to fixed point notation Sxxxxxxxxxxx.xxx
int16_t sinrFp = LteFfConverter::double2fpS11dot3 (sinrdb);
ulcqi.m_sinr.push_back (sinrFp);
ulcqi.m_ulCqi.m_sinr.push_back (sinrFp);
i++;
}
return (ulcqi);
@@ -594,13 +598,13 @@ LteEnbPhy::CreatePuschCqiReport (const SpectrumValue& sinr)
}
UlCqi_s
FfMacSchedSapProvider::SchedUlCqiInfoReqParameters
LteEnbPhy::CreateSrsCqiReport (const SpectrumValue& sinr)
{
NS_LOG_FUNCTION (this << sinr);
Values::const_iterator it;
UlCqi_s ulcqi;
ulcqi.m_type = UlCqi_s::PUSCH;
FfMacSchedSapProvider::SchedUlCqiInfoReqParameters ulcqi;
ulcqi.m_ulCqi.m_type = UlCqi_s::SRS;
int i = 0;
for (it = sinr.ConstValuesBegin (); it != sinr.ConstValuesEnd (); it++)
{
@@ -608,9 +612,17 @@ LteEnbPhy::CreateSrsCqiReport (const SpectrumValue& sinr)
// NS_LOG_DEBUG ("ULCQI RB " << i << " value " << sinrdb);
// convert from double to fixed point notation Sxxxxxxxxxxx.xxx
int16_t sinrFp = LteFfConverter::double2fpS11dot3 (sinrdb);
ulcqi.m_sinr.push_back (sinrFp);
ulcqi.m_ulCqi.m_sinr.push_back (sinrFp);
i++;
}
// Insert the user generated the srs as a vendor specific parameter
NS_LOG_DEBUG (this << " ENB RX UL-CQI of " << m_srsUeOffset.at (m_currentSrsOffset));
VendorSpecificListElement_s vsp;
vsp.m_type = SRS_CQI_RNTI_VSP;
vsp.m_length = sizeof(SrsCqiRntiVsp);
Ptr<SrsCqiRntiVsp> rnti = Create <SrsCqiRntiVsp> (m_srsUeOffset.at (m_currentSrsOffset));
vsp.m_value = rnti;
ulcqi.m_vendorSpecificList.push_back (vsp);
return (ulcqi);
}
@@ -655,17 +667,28 @@ void
LteEnbPhy::DoSetSrsConfigurationIndex (uint16_t rnti, uint16_t srcCi)
{
NS_LOG_FUNCTION (this);
m_srsPeriodicity = GetSrsPeriodicity (srcCi);
uint16_t p = GetSrsPeriodicity (srcCi);
if (p!=m_srsPeriodicity)
{
// resize the array of offset -> re-initialize variables
m_srsUeOffset.clear ();
m_srsUeOffset.resize (p, 0);
m_srsPeriodicity = p;
m_currentSrsOffset = p - 1; // for starting from 0 next subframe
}
NS_LOG_DEBUG (this << " ENB SRS P " << m_srsPeriodicity << " RNTI " << rnti << " offset " << GetSrsSubframeOffset (srcCi) << " CI " << srcCi);
std::map <uint16_t,uint16_t>::iterator it = m_srsCounter.find (rnti);
if (it != m_srsCounter.end ())
{
(*it).second = GetSrsSubframeOffset (srcCi) + 1;
}
else
else
{
m_srsCounter.insert (std::pair<uint16_t, uint16_t> (rnti, GetSrsSubframeOffset (srcCi) + 1));
}
m_srsUeOffset.at (GetSrsSubframeOffset (srcCi)) = rnti;
}

View File

@@ -144,14 +144,14 @@ public:
* the physical layer with the PUSCH signal received from eNB
* \param sinr SINR values vector
*/
UlCqi_s CreatePuschCqiReport (const SpectrumValue& sinr);
FfMacSchedSapProvider::SchedUlCqiInfoReqParameters CreatePuschCqiReport (const SpectrumValue& sinr);
/**
* \brief Create the UL CQI feedback from SINR values perceived at
* the physical layer with the SRS signal received from eNB
* \param sinr SINR values vector
*/
UlCqi_s CreateSrsCqiReport (const SpectrumValue& sinr);
FfMacSchedSapProvider::SchedUlCqiInfoReqParameters CreateSrsCqiReport (const SpectrumValue& sinr);
void DoSendLteControlMessage (Ptr<LteControlMessage> msg);
@@ -232,6 +232,8 @@ private:
uint16_t m_srsPeriodicity;
std::map <uint16_t,uint16_t> m_srsCounter;
std::vector <uint16_t> m_srsUeOffset;
uint16_t m_currentSrsOffset;
};

View File

@@ -24,6 +24,7 @@
#include <ns3/simulator.h>
#include <ns3/lte-amc.h>
#include <ns3/pf-ff-mac-scheduler.h>
#include <ns3/lte-vendor-specific-parameters.h>
NS_LOG_COMPONENT_DEFINE ("PfFfMacScheduler");
@@ -290,14 +291,13 @@ PfFfMacScheduler::DoCschedUeConfigReq (const struct FfMacCschedSapProvider::Csch
NS_LOG_FUNCTION (this << " RNTI " << params.m_rnti << " txMode " << (uint16_t)params.m_transmissionMode);
std::map <uint16_t,uint8_t>::iterator it = m_uesTxMode.find (params.m_rnti);
if (it==m_uesTxMode.end ())
{
m_uesTxMode.insert (std::pair <uint16_t, double> (params.m_rnti, params.m_transmissionMode));
}
{
m_uesTxMode.insert (std::pair <uint16_t, double> (params.m_rnti, params.m_transmissionMode));
}
else
{
(*it).second = params.m_transmissionMode;
}
return;
{
(*it).second = params.m_transmissionMode;
}
return;
}
@@ -1047,6 +1047,32 @@ PfFfMacScheduler::DoSchedUlCqiInfoReq (const struct FfMacSchedSapProvider::Sched
NS_LOG_FUNCTION (this);
// NS_LOG_DEBUG (this << " RX SFNID " << params.m_sfnSf);
// retrieve the allocation for this subframe
switch (m_ulCqiFilter)
{
case FfMacScheduler::SRS:
{
// filter all the CQIs that are not SRS based
if (params.m_ulCqi.m_type!=UlCqi_s::SRS)
{
return;
}
}
break;
case FfMacScheduler::PUSCH:
{
// filter all the CQIs that are not SRS based
if (params.m_ulCqi.m_type!=UlCqi_s::PUSCH)
{
return;
}
}
case FfMacScheduler::ALL:
break;
default:
NS_FATAL_ERROR ("Unknown UL CQI type");
}
std::map <uint16_t, std::vector <uint16_t> >::iterator itMap;
std::map <uint16_t, std::vector <double> >::iterator itCqi;
itMap = m_allocationMaps.find (params.m_sfnSf);

View File

@@ -850,6 +850,31 @@ RrFfMacScheduler::DoSchedUlCqiInfoReq (const struct FfMacSchedSapProvider::Sched
NS_LOG_FUNCTION (this);
NS_LOG_DEBUG (this << " RX SFNID " << params.m_sfnSf);
// NS_LOG_DEBUG (this << " Actual sfn " << frameNo << " sbfn " << subframeNo << " sfnSf " << sfnSf);
switch (m_ulCqiFilter)
{
case FfMacScheduler::SRS:
{
// filter all the CQIs that are not SRS based
if (params.m_ulCqi.m_type!=UlCqi_s::SRS)
{
return;
}
}
break;
case FfMacScheduler::PUSCH:
{
// filter all the CQIs that are not SRS based
if (params.m_ulCqi.m_type!=UlCqi_s::PUSCH)
{
return;
}
}
case FfMacScheduler::ALL:
break;
default:
NS_FATAL_ERROR ("Unknown UL CQI type");
}
// retrieve the allocation for this subframe
std::map <uint16_t, std::vector <uint16_t> >::iterator itMap;
std::map <uint16_t, std::vector <double> >::iterator itCqi;

View File

@@ -41,6 +41,7 @@ def build(bld):
'helper/radio-environment-map-helper.cc',
'helper/lte-hex-grid-enb-topology-helper.cc',
'model/rem-spectrum-phy.cc',
'model/ff-mac-common.cc',
'model/ff-mac-csched-sap.cc',
'model/ff-mac-sched-sap.cc',
'model/lte-mac-sap.cc',
@@ -63,7 +64,8 @@ def build(bld):
'model/epc-sgw-pgw-application.cc',
'model/epc-tft.cc',
'model/epc-tft-classifier.cc',
'model/lte-mi-error-model.cc'
'model/lte-mi-error-model.cc',
'model/lte-vendor-specific-parameters.cc'
]
module_test = bld.create_ns3_module_test_library('lte')
@@ -157,6 +159,7 @@ def build(bld):
'model/epc-gtpu-header.h',
'model/epc-enb-application.h',
'model/epc-sgw-pgw-application.h',
'model/lte-vendor-specific-parameters.h',
'test/lte-test-downlink-sinr.h',
'test/lte-test-uplink-sinr.h',
'test/lte-test-link-adaptation.h',