From 5d17c852d448c6017bb0db115f9e38490c85a97c Mon Sep 17 00:00:00 2001 From: Marco Miozzo Date: Wed, 4 Jul 2012 12:22:21 +0200 Subject: [PATCH] Update SRS-CQI management in RR and PF Schedulers --- src/lte/model/ff-mac-scheduler.cc | 10 +- src/lte/model/ff-mac-scheduler.h | 6 +- src/lte/model/pf-ff-mac-scheduler.cc | 154 ++++++++++++++++------- src/lte/model/rr-ff-mac-scheduler.cc | 146 +++++++++++++++------ src/lte/test/lte-test-interference.cc | 2 + src/lte/test/lte-test-phy-error-model.cc | 2 + src/lte/test/test-lte-antenna.cc | 3 + 7 files changed, 230 insertions(+), 93 deletions(-) diff --git a/src/lte/model/ff-mac-scheduler.cc b/src/lte/model/ff-mac-scheduler.cc index 84829b30a..d03988772 100644 --- a/src/lte/model/ff-mac-scheduler.cc +++ b/src/lte/model/ff-mac-scheduler.cc @@ -32,7 +32,7 @@ NS_OBJECT_ENSURE_REGISTERED (FfMacScheduler); FfMacScheduler::FfMacScheduler () -: m_ulCqiFilter (ALL) +: m_ulCqiFilter (ALL_UL_CQI) { NS_LOG_FUNCTION (this); } @@ -56,11 +56,11 @@ FfMacScheduler::GetTypeId (void) .SetParent () .AddAttribute ("UlCqiFilter", "The filter to apply on UL CQIs received", - EnumValue (FfMacScheduler::ALL), + EnumValue (FfMacScheduler::ALL_UL_CQI), MakeEnumAccessor (&FfMacScheduler::m_ulCqiFilter), - MakeEnumChecker (FfMacScheduler::SRS, "SRS", - FfMacScheduler::PUSCH, "PUSCH", - FfMacScheduler::ALL, "ALL")) + MakeEnumChecker (FfMacScheduler::SRS_UL_CQI, "SRS_UL_CQI", + FfMacScheduler::PUSCH_UL_CQI, "PUSCH_UL_CQI", + FfMacScheduler::ALL_UL_CQI, "ALL_UL_CQI")) ; return tid; } diff --git a/src/lte/model/ff-mac-scheduler.h b/src/lte/model/ff-mac-scheduler.h index 62e58c0cb..8afb09dd3 100644 --- a/src/lte/model/ff-mac-scheduler.h +++ b/src/lte/model/ff-mac-scheduler.h @@ -51,9 +51,9 @@ public: */ enum UlCqiFilter_t { - SRS, - PUSCH, - ALL + SRS_UL_CQI, + PUSCH_UL_CQI, + ALL_UL_CQI }; /** * constructor diff --git a/src/lte/model/pf-ff-mac-scheduler.cc b/src/lte/model/pf-ff-mac-scheduler.cc index 113709818..4b2d95bd6 100644 --- a/src/lte/model/pf-ff-mac-scheduler.cc +++ b/src/lte/model/pf-ff-mac-scheduler.cc @@ -1049,7 +1049,7 @@ PfFfMacScheduler::DoSchedUlCqiInfoReq (const struct FfMacSchedSapProvider::Sched // retrieve the allocation for this subframe switch (m_ulCqiFilter) { - case FfMacScheduler::SRS: + case FfMacScheduler::SRS_UL_CQI: { // filter all the CQIs that are not SRS based if (params.m_ulCqi.m_type!=UlCqi_s::SRS) @@ -1058,7 +1058,7 @@ PfFfMacScheduler::DoSchedUlCqiInfoReq (const struct FfMacSchedSapProvider::Sched } } break; - case FfMacScheduler::PUSCH: + case FfMacScheduler::PUSCH_UL_CQI: { // filter all the CQIs that are not SRS based if (params.m_ulCqi.m_type!=UlCqi_s::PUSCH) @@ -1066,64 +1066,128 @@ PfFfMacScheduler::DoSchedUlCqiInfoReq (const struct FfMacSchedSapProvider::Sched return; } } - case FfMacScheduler::ALL: + case FfMacScheduler::ALL_UL_CQI: break; default: NS_FATAL_ERROR ("Unknown UL CQI type"); } - std::map >::iterator itMap; - std::map >::iterator itCqi; - itMap = m_allocationMaps.find (params.m_sfnSf); - if (itMap == m_allocationMaps.end ()) - { - NS_LOG_DEBUG (this << " Does not find info on allocation, size : " << m_allocationMaps.size ()); - return; - } - for (uint32_t i = 0; i < (*itMap).second.size (); i++) - { - // convert from fixed point notation Sxxxxxxxxxxx.xxx to double -// NS_LOG_INFO (this << " i " << i << " size " << params.m_ulCqi.m_sinr.size () << " mapSIze " << (*itMap).second.size ()); - double sinr = LteFfConverter::fpS11dot3toDouble (params.m_ulCqi.m_sinr.at (i)); - //NS_LOG_DEBUG (this << " UE " << (*itMap).second.at (i) << " SINRfp " << params.m_ulCqi.m_sinr.at (i) << " sinrdb " << sinr); - itCqi = m_ueCqi.find ((*itMap).second.at (i)); - if (itCqi == m_ueCqi.end ()) + switch (params.m_ulCqi.m_type) + { + case UlCqi_s::PUSCH: + { + std::map >::iterator itMap; + std::map >::iterator itCqi; + itMap = m_allocationMaps.find (params.m_sfnSf); + if (itMap == m_allocationMaps.end ()) + { + NS_LOG_DEBUG (this << " Does not find info on allocation, size : " << m_allocationMaps.size ()); + return; + } + for (uint32_t i = 0; i < (*itMap).second.size (); i++) + { + // convert from fixed point notation Sxxxxxxxxxxx.xxx to double + // NS_LOG_INFO (this << " i " << i << " size " << params.m_ulCqi.m_sinr.size () << " mapSIze " << (*itMap).second.size ()); + double sinr = LteFfConverter::fpS11dot3toDouble (params.m_ulCqi.m_sinr.at (i)); + //NS_LOG_DEBUG (this << " UE " << (*itMap).second.at (i) << " SINRfp " << params.m_ulCqi.m_sinr.at (i) << " sinrdb " << sinr); + itCqi = m_ueCqi.find ((*itMap).second.at (i)); + if (itCqi == m_ueCqi.end ()) + { + // create a new entry + std::vector newCqi; + for (uint32_t j = 0; j < m_cschedCellConfig.m_ulBandwidth; j++) + { + if (i == j) + { + newCqi.push_back (sinr); + } + else + { + // initialize with NO_SINR value. + newCqi.push_back (NO_SINR); + } + + } + m_ueCqi.insert (std::pair > ((*itMap).second.at (i), newCqi)); + // generate correspondent timer + m_ueCqiTimers.insert (std::pair ((*itMap).second.at (i), m_cqiTimersThreshold)); + } + else + { + // update the value + (*itCqi).second.at (i) = sinr; + // update correspondent timer + std::map ::iterator itTimers; + itTimers = m_ueCqiTimers.find ((*itMap).second.at (i)); + (*itTimers).second = m_cqiTimersThreshold; + + } + + } + // remove obsolete info on allocation + m_allocationMaps.erase (itMap); + } + break; + case UlCqi_s::SRS: + { + // get the RNTI from vendor specific parameters + uint16_t rnti; + NS_ASSERT (params.m_vendorSpecificList.size () > 0); + for (uint16_t i = 0; i < params.m_vendorSpecificList.size (); i++) + { + if (params.m_vendorSpecificList.at (i).m_type == SRS_CQI_RNTI_VSP) + { + Ptr vsp = DynamicCast (params.m_vendorSpecificList.at (i).m_value); + rnti = vsp->GetRnti (); + } + } + std::map >::iterator itCqi; + itCqi = m_ueCqi.find (rnti); + if (itCqi == m_ueCqi.end ()) + { + // create a new entry + std::vector newCqi; + for (uint32_t j = 0; j < m_cschedCellConfig.m_ulBandwidth; j++) + { + double sinr = LteFfConverter::fpS11dot3toDouble (params.m_ulCqi.m_sinr.at (j)); + newCqi.push_back (sinr); + NS_LOG_DEBUG (this << " RNTI " << rnti << " new SRS-CQI for RB " << j << " value " << sinr); + + } + m_ueCqi.insert (std::pair > (rnti, newCqi)); + // generate correspondent timer + m_ueCqiTimers.insert (std::pair (rnti, m_cqiTimersThreshold)); + } + else { - // create a new entry - std::vector newCqi; + // update the values for (uint32_t j = 0; j < m_cschedCellConfig.m_ulBandwidth; j++) { - if (i == j) - { - newCqi.push_back (sinr); - } - else - { - // initialize with NO_SINR value. - newCqi.push_back (NO_SINR); - } - + double sinr = LteFfConverter::fpS11dot3toDouble (params.m_ulCqi.m_sinr.at (j)); + (*itCqi).second.at (j) = sinr; + NS_LOG_DEBUG (this << " RNTI " << rnti << " update SRS-CQI for RB " << j << " value " << sinr); } - m_ueCqi.insert (std::pair > ((*itMap).second.at (i), newCqi)); - // generate correspondent timer - m_ueCqiTimers.insert (std::pair ((*itMap).second.at (i), m_cqiTimersThreshold)); - } - else - { - // update the value - (*itCqi).second.at (i) = sinr; // update correspondent timer std::map ::iterator itTimers; - itTimers = m_ueCqiTimers.find ((*itMap).second.at (i)); + itTimers = m_ueCqiTimers.find (rnti); (*itTimers).second = m_cqiTimersThreshold; } - - } - // remove obsolete info on allocation - m_allocationMaps.erase (itMap); - + + + } + break; + case UlCqi_s::PUCCH_1: + case UlCqi_s::PUCCH_2: + case UlCqi_s::PRACH: + { + NS_FATAL_ERROR ("PfFfMacScheduler supports only PUSCH and SRS UL-CQIs"); + } + break; + default: + NS_FATAL_ERROR ("Unknown type of UL-CQI"); + } return; } diff --git a/src/lte/model/rr-ff-mac-scheduler.cc b/src/lte/model/rr-ff-mac-scheduler.cc index b7b8a2d2e..45257949c 100644 --- a/src/lte/model/rr-ff-mac-scheduler.cc +++ b/src/lte/model/rr-ff-mac-scheduler.cc @@ -25,6 +25,7 @@ #include #include #include +#include NS_LOG_COMPONENT_DEFINE ("RrFfMacScheduler"); @@ -852,7 +853,7 @@ RrFfMacScheduler::DoSchedUlCqiInfoReq (const struct FfMacSchedSapProvider::Sched // NS_LOG_DEBUG (this << " Actual sfn " << frameNo << " sbfn " << subframeNo << " sfnSf " << sfnSf); switch (m_ulCqiFilter) { - case FfMacScheduler::SRS: + case FfMacScheduler::SRS_UL_CQI: { // filter all the CQIs that are not SRS based if (params.m_ulCqi.m_type!=UlCqi_s::SRS) @@ -861,7 +862,7 @@ RrFfMacScheduler::DoSchedUlCqiInfoReq (const struct FfMacSchedSapProvider::Sched } } break; - case FfMacScheduler::PUSCH: + case FfMacScheduler::PUSCH_UL_CQI: { // filter all the CQIs that are not SRS based if (params.m_ulCqi.m_type!=UlCqi_s::PUSCH) @@ -869,62 +870,127 @@ RrFfMacScheduler::DoSchedUlCqiInfoReq (const struct FfMacSchedSapProvider::Sched return; } } - case FfMacScheduler::ALL: + case FfMacScheduler::ALL_UL_CQI: break; default: NS_FATAL_ERROR ("Unknown UL CQI type"); } - // retrieve the allocation for this subframe - std::map >::iterator itMap; - std::map >::iterator itCqi; - itMap = m_allocationMaps.find (params.m_sfnSf); - if (itMap == m_allocationMaps.end ()) + switch (params.m_ulCqi.m_type) { - NS_LOG_DEBUG (this << " Does not find info on allocation"); - return; - } - for (uint32_t i = 0; i < (*itMap).second.size (); i++) - { - // convert from fixed point notation Sxxxxxxxxxxx.xxx to double - double sinr = LteFfConverter::fpS11dot3toDouble (params.m_ulCqi.m_sinr.at (i)); -// NS_LOG_DEBUG (this << " RB " << i << "UE " << (*itMap).second.at (i) << " SINRfp " << params.m_ulCqi.m_sinr.at (i) << " sinrdb " << sinr); - itCqi = m_ueCqi.find ((*itMap).second.at (i)); - if (itCqi == m_ueCqi.end ()) + case UlCqi_s::PUSCH: { - // create a new entry - std::vector newCqi; - for (uint32_t j = 0; j < m_cschedCellConfig.m_ulBandwidth; j++) + std::map >::iterator itMap; + std::map >::iterator itCqi; + itMap = m_allocationMaps.find (params.m_sfnSf); + if (itMap == m_allocationMaps.end ()) { - if (i == j) + NS_LOG_DEBUG (this << " Does not find info on allocation, size : " << m_allocationMaps.size ()); + return; + } + for (uint32_t i = 0; i < (*itMap).second.size (); i++) + { + // convert from fixed point notation Sxxxxxxxxxxx.xxx to double + // NS_LOG_INFO (this << " i " << i << " size " << params.m_ulCqi.m_sinr.size () << " mapSIze " << (*itMap).second.size ()); + double sinr = LteFfConverter::fpS11dot3toDouble (params.m_ulCqi.m_sinr.at (i)); + //NS_LOG_DEBUG (this << " UE " << (*itMap).second.at (i) << " SINRfp " << params.m_ulCqi.m_sinr.at (i) << " sinrdb " << sinr); + itCqi = m_ueCqi.find ((*itMap).second.at (i)); + if (itCqi == m_ueCqi.end ()) { - newCqi.push_back (sinr); + // create a new entry + std::vector newCqi; + for (uint32_t j = 0; j < m_cschedCellConfig.m_ulBandwidth; j++) + { + if (i == j) + { + newCqi.push_back (sinr); + } + else + { + // initialize with NO_SINR value. + newCqi.push_back (30.0); + } + + } + m_ueCqi.insert (std::pair > ((*itMap).second.at (i), newCqi)); + // generate correspondent timer + m_ueCqiTimers.insert (std::pair ((*itMap).second.at (i), m_cqiTimersThreshold)); } else { - // initialize with maximum value according to the fixed point notation - newCqi.push_back (30.0); + // update the value + (*itCqi).second.at (i) = sinr; + // update correspondent timer + std::map ::iterator itTimers; + itTimers = m_ueCqiTimers.find ((*itMap).second.at (i)); + (*itTimers).second = m_cqiTimersThreshold; + } - + } - m_ueCqi.insert (std::pair > ((*itMap).second.at (i), newCqi)); - // generate correspondent timer - m_ueCqiTimers.insert (std::pair ((*itMap).second.at (i), m_cqiTimersThreshold)); + // remove obsolete info on allocation + m_allocationMaps.erase (itMap); } - else + break; + case UlCqi_s::SRS: { - // update the value - (*itCqi).second.at (i) = sinr; - // update correspondent timer - std::map ::iterator itTimers; - itTimers = m_ueCqiTimers.find ((*itMap).second.at (i)); - (*itTimers).second = m_cqiTimersThreshold; + // get the RNTI from vendor specific parameters + uint16_t rnti; + NS_ASSERT (params.m_vendorSpecificList.size () > 0); + for (uint16_t i = 0; i < params.m_vendorSpecificList.size (); i++) + { + if (params.m_vendorSpecificList.at (i).m_type == SRS_CQI_RNTI_VSP) + { + Ptr vsp = DynamicCast (params.m_vendorSpecificList.at (i).m_value); + rnti = vsp->GetRnti (); + } + } + std::map >::iterator itCqi; + itCqi = m_ueCqi.find (rnti); + if (itCqi == m_ueCqi.end ()) + { + // create a new entry + std::vector newCqi; + for (uint32_t j = 0; j < m_cschedCellConfig.m_ulBandwidth; j++) + { + double sinr = LteFfConverter::fpS11dot3toDouble (params.m_ulCqi.m_sinr.at (j)); + newCqi.push_back (sinr); + NS_LOG_DEBUG (this << " RNTI " << rnti << " new SRS-CQI for RB " << j << " value " << sinr); + + } + m_ueCqi.insert (std::pair > (rnti, newCqi)); + // generate correspondent timer + m_ueCqiTimers.insert (std::pair (rnti, m_cqiTimersThreshold)); + } + else + { + // update the values + for (uint32_t j = 0; j < m_cschedCellConfig.m_ulBandwidth; j++) + { + double sinr = LteFfConverter::fpS11dot3toDouble (params.m_ulCqi.m_sinr.at (j)); + (*itCqi).second.at (j) = sinr; + NS_LOG_DEBUG (this << " RNTI " << rnti << " update SRS-CQI for RB " << j << " value " << sinr); + } + // update correspondent timer + std::map ::iterator itTimers; + itTimers = m_ueCqiTimers.find (rnti); + (*itTimers).second = m_cqiTimersThreshold; + + } + + } - + break; + case UlCqi_s::PUCCH_1: + case UlCqi_s::PUCCH_2: + case UlCqi_s::PRACH: + { + NS_FATAL_ERROR ("PfFfMacScheduler supports only PUSCH and SRS UL-CQIs"); + } + break; + default: + NS_FATAL_ERROR ("Unknown type of UL-CQI"); } - // remove obsolete info on allocation - m_allocationMaps.erase (itMap); - return; } diff --git a/src/lte/test/lte-test-interference.cc b/src/lte/test/lte-test-interference.cc index 09393f8d7..944d5de0c 100644 --- a/src/lte/test/lte-test-interference.cc +++ b/src/lte/test/lte-test-interference.cc @@ -27,6 +27,7 @@ #include "ns3/mobility-helper.h" #include "ns3/lte-helper.h" +#include "ns3/ff-mac-scheduler.h" #include "ns3/lte-enb-phy.h" #include "ns3/lte-enb-net-device.h" @@ -153,6 +154,7 @@ LteInterferenceTestCase::DoRun (void) NetDeviceContainer ueDevs1; NetDeviceContainer ueDevs2; lteHelper->SetSchedulerType ("ns3::RrFfMacScheduler"); + lteHelper->SetSchedulerAttribute ("UlCqiFilter", EnumValue (FfMacScheduler::PUSCH_UL_CQI)); enbDevs = lteHelper->InstallEnbDevice (enbNodes); ueDevs1 = lteHelper->InstallUeDevice (ueNodes1); ueDevs2 = lteHelper->InstallUeDevice (ueNodes2); diff --git a/src/lte/test/lte-test-phy-error-model.cc b/src/lte/test/lte-test-phy-error-model.cc index 759b1a112..f56b1d73f 100644 --- a/src/lte/test/lte-test-phy-error-model.cc +++ b/src/lte/test/lte-test-phy-error-model.cc @@ -47,6 +47,7 @@ #include #include #include +#include NS_LOG_COMPONENT_DEFINE ("LenaTestPhyErrorModel"); @@ -184,6 +185,7 @@ LenaPhyErrorModelTestCase::DoRun (void) NetDeviceContainer enbDevs; NetDeviceContainer ueDevs; lena->SetSchedulerType ("ns3::RrFfMacScheduler"); + lena->SetSchedulerAttribute ("UlCqiFilter", EnumValue (FfMacScheduler::PUSCH_UL_CQI)); enbDevs = lena->InstallEnbDevice (enbNodes); ueDevs = lena->InstallUeDevice (ueNodes); diff --git a/src/lte/test/test-lte-antenna.cc b/src/lte/test/test-lte-antenna.cc index b741ebf5c..0c3c8743e 100644 --- a/src/lte/test/test-lte-antenna.cc +++ b/src/lte/test/test-lte-antenna.cc @@ -23,6 +23,7 @@ #include "ns3/log.h" #include "ns3/string.h" #include "ns3/double.h" +#include "ns3/enum.h" #include "ns3/test.h" #include "ns3/mobility-helper.h" #include "ns3/lte-helper.h" @@ -31,6 +32,7 @@ #include "ns3/lte-ue-net-device.h" #include "ns3/lte-enb-phy.h" #include "ns3/lte-enb-net-device.h" +#include "ns3/ff-mac-scheduler.h" #include "lte-test-sinr-chunk-processor.h" @@ -117,6 +119,7 @@ LteEnbAntennaTestCase::DoRun (void) NetDeviceContainer enbDevs; NetDeviceContainer ueDevs; lteHelper->SetSchedulerType ("ns3::RrFfMacScheduler"); + lteHelper->SetSchedulerAttribute ("UlCqiFilter", EnumValue (FfMacScheduler::PUSCH_UL_CQI)); lteHelper->SetEnbAntennaModelType ("ns3::CosineAntennaModel"); lteHelper->SetEnbAntennaModelAttribute ("Orientation", DoubleValue (m_orientationDegrees)); lteHelper->SetEnbAntennaModelAttribute ("Beamwidth", DoubleValue (m_beamwidthDegrees));